Newbie: Convert strings in nested dict to tuples
KP
kai.peters at gmail.com
Tue Dec 22 18:14:57 EST 2015
I now know how to convert a string cont. coordinates to a tuple, but hwo can I do this?
Given
cfg = {'canvas': ('3840', '1024'),
'panel1': {'gpio': '1', 'id': '4', 'co': '0,0,1280,1024'},
'panel2': {'gpio': '2', 'id': '5', 'co': '1280,0,2560,1024'},
'panel3': {'gpio': '3', 'id': '6', 'co': '2560,0,3840,1024'}}
how can I transform cfg to
cfg = {'canvas': ('3840', '1024'),
'panel1': {'gpio': '1', 'id': '4', 'co': ('0','0','1280','1024')},
'panel2': {'gpio': '2', 'id': '5', 'co': ('1280','0','2560','1024')},
'panel3': {'gpio': '3', 'id': '6', 'co': ('2560','0','3840','1024')}}
Again, thanks for all help!
More information about the Python-list
mailing list