【发布时间】:2021-12-02 14:23:01
【问题描述】:
我正在尝试在这段代码中创建文件 py.py
def makeFile():
contents = "import JustIRC\nimport requests";
file = open('py.py');
file.write(contents);
file.close();
但如果我运行它,它会返回 io.UnsupportedOperation: not writable 问题是什么,我该如何解决?我需要能够专门为程序正确运行制表符和换行符
【问题讨论】:
标签: python file file-handling