dict运行报错
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key+":"+d[key]
TypeError: cannot concatenate 'str' and 'int' objects
字符类型和数字类型不能用+拼接,而是用","
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key+":",d[key]