2013-12-22 45 views
0

听起来真的很天真。我注意到很多答案,但没有确实帮助我的情况下Python IO错误

import csv 
from collections import defaultdict 

with open("aa_y_ss.csv", 'rb') as csvfile: 
    allrows = csv.reader(csvfile, delimiter=',') 
    for row in allrows: 

抛出一个错误IOError: [Errno 2] No such file or directory

但该文件是有目录

我已经检查当前目录:

import os 
os.getcwd() 

C:\\Users\\ ....\\Documents\\IPython Notebooks

为什么我得到这个错误?

+0

您的文件名为'文件名'? – shx2

+0

你可以发布不起作用的确切代码吗? – shx2

+0

我刚刚添加它然后来一个for循环中,我在文件中做一些计算,但错误是在阅读文件的行 – Ady

回答

0

为什么不尝试重命名文件? 我有类似的问题,我做到了。问题不存在