【发布时间】:2022-11-27 05:46:55
【问题描述】:
我不断收到错误消息:FileNotFoundError: [Errno 2] No such file or directory: 'Bayofagbenro.txt' 这是我的代码:
def main():
outfile = open('Bayofagbenro.txt')
Bayofagbenro =outfile.write ('Modupeola\n')
Bayofagbenro =outfile.w ('Ayobami\n')
Bayofagbenro =outfile.w ('AKintola\n')
Bayofagbenro =outfile.w ('Omonike\n')
Bayofagbenro =outfile.w ('Fehintoluwa\n')
Bayofagbenro =outfile.w ('Modupeola is 44yrs, Ayobami is 42 years, AKintola is 38 years, omonike is 36 years while fehintoluwa is 30 years')
outfile = Bayofagbenro.r
outfile.close
if __name__ == "__main__":
main()
期待这样的事情:
【问题讨论】:
-
尝试使用
open('Bayofagbenro.txt', 'w')你需要指定你想写给它
标签: python