【发布时间】:2017-05-25 17:37:35
【问题描述】:
这是我的 python 程序代码,但我不能写marks.txt 我得到这样的错误它在x 之后显示 Python代码
file = open('marks.txt','w')
s1marks=0
s2marks=0
index=int(input("index:"))
if index != -1:
s1marks=str(input("subject1marks:"))
s2marks=str(input("subject2marks:"))
x=str("index is"+index+s1marks+s2marks)
file.write(x)
index=int(input("next index:"))
file.close()
错误
索引:10 主题1分:8 科目2分:5 回溯(最近一次通话最后): 文件“”,第 10 行,在 TypeError: 无法将 'int' 对象隐式转换为 str
【问题讨论】:
标签: python-3.x