I am trying to get only attribute name in one horizontal line.
import xml.etree.ElementTree as ET
data = '''
<job_details>
<role>
<name>Vikas</name>
<salary>$5.95</salary>
<job_description>Developer</job_description>
</role>
<role>
<name>Dip</name>
<salary>$7.95</salary>
<job_description>Backend Developer</job_description>
</role>
</job_details>
'''
xml_parsing = ET.fromstring(data)
for sub_attrib in xml_parsing[0]:
print(sub_attrib.tag)
Expected output:
name,salary,job_description