为了计算XML标记的起始和结束书签,我遇到了一个问题:
源代码:
<?xml version="1.0" encoding="UTF-8"?>
<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>$5.95</price>
<description>
Two of our famous Belgian Waffles with plenty of real maple syrup
</description>
<calories>650</calories>
</food>
</breakfast_menu>
输出:
Tag_name | Bookmark(Row number : Column no in file)
Breakfast Starting ->2:1 | Ending : 11:1
Food Starting ->3:4 | Ending : 10:4
注意:这里在输出前应计算标记空格。
Python中是否有任何固定的算法或现有的库来计算书签?你知道吗
您可以使用The ElementTree XML API并编写另一个解析器:
输出:
顺便说一下,您忘了在xml的末尾加一个斜杠。你知道吗
相关问题 更多 >
编程相关推荐