【发布时间】:2019-03-05 03:12:08
【问题描述】:
我正在尝试用 Python 重新创建口袋妖怪伤害计算器:https://github.com/Zarel/honko-damagecalc/blob/master/js/data/move_data.js
他的字典以:
开头var MOVES_RBY = {
'(No Move)': {
bp: 0,
type: 'Normal',
category: 'Physical'
},
我的 Python 脚本中有这个,但没有 var,它会返回错误
Traceback(最近一次调用最后一次):文件“”,第 2 行,in NameError: 名称 'bp' 未定义
如何定义bp 以类似方式使用它?
【问题讨论】:
-
你的代码看起来不像 python
-
如果你对 Python 不够熟悉,你应该从Python tutorial开始
标签: python dictionary key