The two-dimensional structure [[ 'a', 1], [ 'b', 2]], and (( 'x', 3), ( 'y', 4)) is converted into the dictionary

Code:

l = [['a',1],['b',2]]
t = (('x',3),('y',4))
d_l = dict(l)
d_t = dict(t)
print(d_l)
print(d_t)

result:

{'a': 1, 'b': 2}
{ ' X ' : 3 , ' and ' : 4 }

 

Guess you like

Origin www.cnblogs.com/lihe94/p/11982390.html