In Python 3 I've created an empty dictionary with the following keys:
default_value = ''
sq = dict.fromkeys(['Num','ID','Cognome','Data','altezza','V6','spec_role','V8','Nome','Ruolo','nick','trasf','straniero','pict','V15','V16','V17'],default_value)
I don't know how to load values from a string like this sequentially:
line = '1 LUC-TOR Tortuga 10/13/1991 LUC-TOR Luca 2 Tortuga 33524.7 '
to obtain:
mydict = {
"Num": 1,
"ID": LUC-TOR,
"Cognome": Tortuga,
"Data": 10/13/1991
"altezza":
"V6":
"spec_role":
"V8":
"Nome": Luca
"Ruolo": 2
"nick": Tortuga
"trasf":
"straniero":
"pict":
"V15":
"V16":
"V17": 33524.7
}
What is the best pythonic way to do it?