lxml.objectify and leading zeros
问题 When the objectify element is printed on the console, the leading zero is lost, but it is preserved in the .text : >>> from lxml import objectify >>> >>> xml = "<a><b>01</b></a>" >>> a = objectify.fromstring(xml) >>> print(a.b) 1 >>> print(a.b.text) 01 From what I understand, objectify automatically makes the b element an IntElement class instance. But, it also does that even if I try to explicitly set the type with an XSD schema: from io import StringIO from lxml import etree, objectify f =