Python问题记录 python操作文件

问题一: can't find '__main__' module in '.'

卡在PyCharm软件很久,刚开始安装的Python3.2,PyCharm无法运行;今天发现版本错了,更换成Python3.7.输入HelloWorld。结果,软件提示: can't find '__main__' module in '.'

百度后发现,很多新手都遇见了此问题,解决起来很简单:Run/Debug Configurations处Script Pathon:要具体到某一个.py文件。

 借用一下别人的截图(原文在此):

问题二:io.UnsupportedOperation: not writable

open函数,有r(只读)、w(只写)模式,默认是r,需要指定为w才能写入。

可以查看此文章学习:python操作文件

猜你喜欢

转载自www.cnblogs.com/xiaohei4/p/10801328.html