文本文件未用python编写

时间:2019-05-29 22:36:19

标签: python python-3.x

我试图写入文本文件,但它保持空白

file = open('AIs.txt', 'w')
file.write(name)
file.close()

这是围绕它的代码,也许这会有所帮助

currentDT = datetime.datetime.now()
date = currentDT.strftime("%d:%m:%y %H:%M:%S")
name = f'AI {date}'
with open(f'{name}.pkl', 'wb') as output:
    pickle.dump(genome, output, 1)
file = open('AIs.txt', 'w')
file.write(name)
file.close()

os.execl(sys.executable, sys.executable, * sys.argv)

我尝试使用写入文本文件

with open('AIs.txt', 'w') as file:

等,但这也不起作用

0 个答案:

没有答案
相关问题