这是课本中的方法,我无法运行
student={"name":{李强},"score":[89,76]}
student["name"]
student["score"][0]
student["score"][1]
下面是我的代码,也无法运行
dict5=dict([("名字","李白"),("作品","将进酒")])
自己写的代码没有报错,但是就是没有报出结果
命令行中运行的时候,会自动打印变量的值
你自己写py文件,需要打印什么,就调用print函数打印呀
print(dict5)
书本中是在python命令行执行的,可以改成这样就行:
student={"name":{'李强'},"score":[89,76]}
print(student["name"])
print(student["score"][0])
print(student["score"][1])