Skip to content

Instantly share code, notes, and snippets.

@rmuslimov
Last active February 19, 2016 04:58
Show Gist options
  • Save rmuslimov/5e4a7fbc2bd892b3f104 to your computer and use it in GitHub Desktop.
Save rmuslimov/5e4a7fbc2bd892b3f104 to your computer and use it in GitHub Desktop.
Python version of parsing
import os
from datetime import datetime
from lxml import etree
def import_file(filename):
with open(filename) as f:
body = etree.fromstring(f.read())
return etree.ETXPath(
'.//{http://schemas.xmlsoap.org/soap/envelope/}Body')(body)
def walk(path):
return [
import_file(os.path.join(path, each)) for each
in os.listdir(path)
]
def main():
t = datetime.now()
print len(walk('/Users/rmuslimov/projects/logs/d=12'))
print datetime.now() - t
main()
# Time elapsed: 0:00:00.379423 sec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment