daily pastebin goal
85%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python3
  2. import fileinput
  3.  
  4. lines = (line.split('\x1e') for line in fileinput.input())
  5. data = []
  6. for line in lines:
  7.     record = {}
  8.     for part in line:
  9.         key, *value = map(str.strip, part.split('\x1f'))
  10.         if key:
  11.             record[key] = [(x[0], x[1:]) for x in value if x]
  12.     data.append(record)
  13. print(data)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top