我正在开发一个在 txt 文件中显示我的信息的项目,它与 print 完美配合,但是当我尝试使用 write 时,它给了我以下错误:
类型错误:write() 参数必须是 str,而不是 dict
这是我的代码:
for x in range(len(list)):
outfile = open('message.txt', 'w')
outfile.write(list[x])
outfile.close()
Run Code Online (Sandbox Code Playgroud) python ×1