i have a list of values that i got when reading an xml file using etree:
[['0']
['0 1.56E-013 2.22E-014 0 0 0']
['-2.84E-014 1.42E-014 2.56E-015 0 0 0']
['0 0 0 0 0 0']
['0 0 0 0 0 0']].
Could someone help me out to append every single values to a list? Something like output =
[0,0,1.56E-013,2.22E-014,0,0,0,-2.84E-014,1.42E-014,2.56E-015,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
I tried using splitlines() when reading from xml and also strip('\n') but i still get the values in the above format.
Thank you in advance
I have added a snippet from an xml and my code:
<Data name="IC_001" id="2">
<Step type="IC">
0
0 1.56E-013 2.22E-014 0 0 0
-2.84E-014 1.42E-014 2.56E-015 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
</Step>
</Data>
My code:
import xml.etree.ElementTree as ET
tree = ET.parse('test2.xml')
root = tree.getroot()
temp = root.findall("./Step")
for item in temp:
values = item.text.strip('\n').splitlines()
print values
My aim is to have every single number into a list. I would really appreciate any help