dickrong 发表于 2018-8-11 13:05:30

python Tutorial 之二

def Walk(xml):  yield xml
  if hasattr(xml, "Attributes"):
  attrs = xml.Attributes
  if attrs:
  for attr in attrs:
  yield attr
  for child in xml:
  for c in Walk(child):
  yield c
页: [1]
查看完整版本: python Tutorial 之二