I would like to recover the integer value of a tag
from xml.dom import minidom
docXML = minidom.parse('/root/Desktop/doc.xml')
node = docXML.getElementsByTagName('span')[0]
value = node.firstChild.data
" return value is 5.22%"
str1 = value.split('%')
"return [u'\n5.22', u'\n']"
finalvalue = ''.join(str1)
"return 5.22"
but if I would to convert this string character
convert = int(finalvalue)
I got the following error
"ValueError invalid literal for int() with base 10: '5.22 ' "
When I use the split method I get the following result:
[u'\n5.22', u'\n']