lin = [('Person1', 80), ('Person2', ), ('Person3', 20), ('Person4', 20, 60)] dout = { t[0] : t[1] if len(t) > 1 else None for t in lin} print(dout)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)