【发布时间】:2017-10-30 16:41:32
【问题描述】:
我有这个 xml 字符串
<aof xmlns="http://tsng.jun.net/jppos/conig/hello"><num>3</num><desc>addy02</desc><tpcs>5</tpcs></aof>'
我需要使用正则表达式提取 5。
我所做的是:
regex = re.compile(r'tag+</.+>\s*(.+)\s*<.+>')
其中标签是“tpcs” 但它返回空标签。
有人可以帮忙吗。
【问题讨论】:
标签: regex python-2.7 xml-parsing regex-negation