Advertisement
cd62131

Split File

Jun 20th, 2017
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. #!/usr/bin/python
  2. # coding: utf-8
  3. import re
  4. import sys
  5. lines = u''.join(open(sys.argv[1]))
  6. re = re.compile(r'(?m)<idnumber>\s+(\d+)\s+<value>\s+\d+')
  7. for m in re.finditer(lines):
  8.   with open(u'{}.txt'.format(m.group(1)), 'w') as out:
  9.     out.write(u"{}\n".format(m.group()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement