d = {'x': 5, 'y': 6, 'z': 7 }
print([k + '=' + v for k, v in d.items()])
报错:Traceback (most recent call last):
File "C:\Users\gyy14\AppData\Local\Temp\learn_python_sjqhlgf2_py\test_53.py", line 3, in <module>
print([k + '=' + v for k, v in d.items()])
File "C:\Users\gyy14\AppData\Local\Temp\learn_python_sjqhlgf2_py\test_53.py", line 3, in <listcomp>
print([k + '=' + v for k, v in d.items()])
TypeError: must be str, not int
阿土伯gyy
d = {'x': 5, 'y': 6, 'z': 7 } print([k + '=' + v for k, v in d.items()]) 报错:Traceback (most recent call last): File "C:\Users\gyy14\AppData\Local\Temp\learn_python_sjqhlgf2_py\test_53.py", line 3, in <module> print([k + '=' + v for k, v in d.items()]) File "C:\Users\gyy14\AppData\Local\Temp\learn_python_sjqhlgf2_py\test_53.py", line 3, in <listcomp> print([k + '=' + v for k, v in d.items()]) TypeError: must be str, not int