2014-04-28 23:54

题目:XML文件的冗余度很大,主要在于尖括号里的字段名。按照书上给定的方式进行压缩。

解法:这题我居然忘做了,只写了一句话的注解。用python能够相对方便地实现,因为有直接的XML工具可以调用。书上的那种要求应该是符合前序遍历规则。

代码:

1 # 17.10 Parse an XML file, and try to save some space by mapping every item name to an integer index.
2 # Answer:
3 #    Preordere traversal of an element tree, maybe ElementTree will be a good tool.

 

相关文章:

  • 2021-10-25
  • 2021-10-30
  • 2021-11-28
  • 2021-09-13
  • 2022-02-18
  • 2021-11-14
  • 2021-10-19
  • 2021-07-13
猜你喜欢
  • 2022-01-24
  • 2021-11-04
  • 2021-09-19
  • 2021-12-30
  • 2021-06-25
  • 2021-10-03
  • 2022-01-29
相关资源
相似解决方案