2010-09-26 21:00:07 +00:00
|
|
|
#!/usr/bin/python
|
2010-09-26 21:00:25 +00:00
|
|
|
import gzip
|
|
|
|
from BeautifulSoup import BeautifulStoneSoup
|
|
|
|
import sys
|
2010-09-26 21:00:07 +00:00
|
|
|
|
2010-09-26 21:00:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
def __main(oo_file):
|
|
|
|
g = open(oo_file)
|
|
|
|
o = open('output.xml', 'w')
|
|
|
|
try:
|
|
|
|
soup = BeautifulStoneSoup(g)
|
|
|
|
count = 0
|
|
|
|
for item in soup.outline.root:
|
|
|
|
if item.parent != soup.outline.root:
|
|
|
|
continue
|
|
|
|
count = count + 1
|
|
|
|
print count
|
|
|
|
finally:
|
|
|
|
g.close()
|
|
|
|
o.close()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
__main(sys.argv[1])
|