fork(3) download
  1. from sys import stdin
  2.  
  3. groups = stdin.read().split("\n\n")
  4. keys = groups[::2]
  5. values = groups[1::2]
  6. res = {k: v.split("\n") for k, v in zip(keys, values)}
  7. print res
Success #stdin #stdout 0.01s 7740KB
stdin
key1

value1
value2
value3

key2

value1
value2
value3
value4

key3

value1

key4

value1
value2
stdout
{'key3': ['value1'], 'key2': ['value1', 'value2', 'value3', 'value4'], 'key1': ['value1', 'value2', 'value3'], 'key4': ['value1', 'value2']}