>>> student={}
>>> student["1"]="1"
>>> student
{'1': '1'}
>>> student("2")="2"
SyntaxError: cannot assign to function call
为什么元组不能这么加入字典
>>> student={}
>>> student["1"]="1"
>>> student
{'1': '1'}
>>> student("2")="2"
SyntaxError: cannot assign to function call
为什么元组不能这么加入字典
student["1"]="1"; 这里的中括号是索引而不是列表,python的索引都是使用中括号。