I get the error saying integer is required
This is my code:
from xml.dom.minidom import parseString
file =open('lang.xml','rb',"utf-8")
data=file.read()
file.close()
dom=parseString(data)
xmlTag=dom.getElementsByTagName('child')[0]
print (xmlTag.attributes['name'].value)
If I try to read without UTF-8 encoding I get :
UnicodeDecodeError: ‘charmap’ codec can’t decode byte 0x81 in position 57: character maps to
My lang.xml file contains translation in different langauges that I need to fetch based on attribute name..
Any help please
Know your documentation:
http://docs.python.org/release/3.0.1/library/functions.html#open
The documentation clearly tells you that the encoding parameter is optional. It’s a keyword parameter – so you must use