I want to store a value from an XML file as a variable in Python to use it for calculations later on. The value shall be the speed of sound. The XML file contains different types of liquid mediums, temperature and speed of sounds. I am loading the XML file with etree.
root = ET.parse(folder_path2+filename8)
SoS = root.find('.//SpeedofSound')
tree = ET.parse(folder_path2+filename8)
root = tree.getroot()
for SoS in root.findall('SpeedofSound'):
The XML looks like this:
<Medium="Water" SpeedofSound=" 1480" Temperature=" 15"/>
I come up to this point, but then I don't know how to store it as a variable.
Thanks.
!!!SOLVED!!!
I did it this way:
SoS = df["SpeedofSound"].dropna().to_numpy()
The value is stored and I can also use it for other calculations.