data = """ rules: evdev model: pc105 layout: us,ru variant: , options: grp:alt_shift_toggle,grp_led:scroll """
хочу получить словарь
{'layout': ‘us,ru’,
‘model’: ‘pc105’,
‘options’: ‘grp:alt_shift_toggle,grp_led:scroll’,
‘rules’: ‘evdev’,
‘variant’: ‘,’}
Делаю так:
dict((a, b.strip()) for a, b in (item.split(":") for item in data.splitlines()))
Получаю:
dict((a, b.strip()) for a, b in
ValueError: too many values to unpack
ЧЯДНТ?