这是我的脚本的1/8:类型错误:必须海峡,不浮
print('Your skill:', int(charskill))
with open('C:\Documents and Settings\Welcome\My Documents\python\Task 2\lol.txt', 'w') as myFile:
myFile.write(charskill)
有一次,我在执行蟒蛇,它给我的错误:
Traceback (most recent call last):
File "C:\Documents and Settings\Welcome\My Documents\python\Task 2\Dice generator v2.py", line 39, in <module>
myFile.write(charskill)
TypeError: must be str, not float
我如何解决这个问题?我希望该文件在记事本上运行; /因为这是我在学校的作业。
's/integer/float /' – delnan
cheers ... fixed – zjm555