我试着把秤上的数字输入一个txt文件。 但是有一个错误。我粘贴的代码在一个类中,只是发布了相关信息
将命令放入pythons内置文件操作的写入部分
self.spawnrate_scale = Scale(from_=10, to=2000, orient=HORIZONTAL, label="Spawn Rate",)
self.spawnrate_scale.grid(row=0, column=1)
self.spawnrate_button = Button(text="Apply", command=self.spawnsetting)
self.spawnrate_button.grid(row=1, column=1)
spawnfile = open("carspawnspeed","w")
spawnfile.write(self.spawnrate_scale.get())
spawnfile.close()
spawnfile.write(self.spawnrate_scale.get())
TypeError:write()参数必须是str,而不是int
改变
到
修好了
相关问题 更多 >
编程相关推荐