遇到问题遍历元组像这样一个元组:迭代与字典里面
t = ('a','b',{'c':'d'})
for a,b,c in t:
print(a,b,c) # ValueError: not enough values to unpack (expected 3, got 1)
for a,b,*c in t:
print(a,b,c) # ValueError: not enough values to unpack (expected 2, got 1)
for a,b,**c in t:
print (a,b,c) # Syntax error (can't do **c)
任何人都知道我可以保存字典值?我想看看a='a', b='b', and c={'c':'d'}
太棒了!谢谢,把它放在列表中,就像我期待的那样。 – denvaar