Python 常见错误及解决办法

 

错误:

Traceback (most recent call last):
 File "I:/Papers/consumer/codeandpaper/RegressionandGBDTandLR
ValueError: I/O operation on closed file

 

将代码:

for line in f:
    print("每一行的数据是:%s" % line)
    f.close()
改为
for line in f:
    print("每一行的数据是:%s" % line)
f.close()
就可以了。

因为:
原来的时候在for循环里进行了close,所以出错

错误:

Traceback (most recent call last):
File "C:/Documents and Settings/Administrator/Desktop/zyx", line 12, in <module>

将代码:

 

 

 

 

 

 “No module named 'matplotlib.pyplot'; 'matplotlib' is not a package”

脚本文件名写成了“matplotlib.py',导致pycharm不能加载正确的包。。。。

 

 

 

 

 

 

posted on 2017-12-18 16:10  CuriousZero  阅读(589)  评论(0编辑  收藏  举报

导航