【发布时间】:2019-12-14 15:52:24
【问题描述】:
我正在尝试为我的朋友编写一个基本的 Python RPG,并且我正在尝试制作一个统计生成器。根据我在课堂上学到的知识,我应该print('Your ability score in this is ' + var1 + '.')
这是我收到错误的整个代码块。
Your elemental attack is '''+ elematk + '''.''')
我得到的错误是
File "/Users/data censored/Desktop/Basic RPG.py", line 24, in <module>
Your elemental attack is '''+ elematk + '''.''')
TypeError: can only concatenate str (not "int") to str
也许我只是不擅长这个。我看了另一个答案,说逗号分隔字符串和 var,但这也不起作用。
【问题讨论】:
-
Your elemental attack is '''+ elematk + '''.''')不是 Python 中的有效代码块。 -
哎呀,我是想先放一个打印标签
标签: python