Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import fileinput
- lines = (line.split('\x1e') for line in fileinput.input())
- data = []
- for line in lines:
- record = {}
- for part in line:
- key, *value = map(str.strip, part.split('\x1f'))
- if key:
- record[key] = [(x[0], x[1:]) for x in value if x]
- data.append(record)
- print(data)
Add Comment
Please, Sign In to add comment