Sunday, 27 March 2016

XML : xml element tree python add hex string to element/tag

I can't seem to add a hex string to an element/tag in xml element tree

Here is the offending code:

  hextext = "H:\myfilepath.myfileending"  StartTag = Element( 'StartTag' )  Data  = SubElement( StartTag, 'Data')  Data.text = str(hextext.encode(hex))    

And I get the error

TypeError: expected a str

No comments:

Post a Comment