1
banxi1988 2019 年 8 月 31 日
1. 错误提示很明显. `dict` 重定义了.
你可以看 `global` 关键词的说明: > Names listed in a global statement must not be used in the same code block textually preceding that global statement. 2. dict 是内置的类名,用来作变量名,习惯不好. 3. 发贴不注意缩进, 差评. |
2
echo1937 2019 年 8 月 31 日 首先,使用 global 时,先声明,再赋值:
global dict dict = OrderedDict(list) 其次,dict 是 build-in name,最好不要拿来当变量名 |
5
swulling 2019 年 8 月 31 日 via iPhone
原则上别用全局变量
|