python - Django lxml parsing issue with value -
i have element submission_ref
text content 123
i'm parsing this:
xml = request.post['xml'].encode('utf-8') parser = etree.xmlparser(ns_clean=true, recover=true, encoding='utf-8') h = fromstring(xml, parser=parser) submission_ref = h.xpath('submission_ref/text()');
my issue cannot use value in variable submission_ref
because looks this: ['123']
after being parsed. see ['
, ']
.
has xpath()
? how can solve this?
the xpath()
function returns list of matches. use first:
submission_ref = h.xpath('submission_ref/text()')[0]
Comments
Post a Comment