I am trying to open a specific file in many folders, with the name ending '.alleles.txt'. I search for the file and it is found, but then it returns:
IOError: [Errno 2] No such file or directory: 'abca3.alleles.txt'
when I try and open it.
for eachfile in filelisting:
if re.search('\.alleles\.txt$', eachfile):
allelesfile = open(eachfile, 'r')
print '2'
Directory is specified by:
folder = 'E:\\All Data'
folderlisting = os.listdir(folder)
for eachfolder in folderlisting:
print eachfolder
if os.path.isdir(folder + '\\' + eachfolder):
filelisting = os.listdir(folder + '\\' + eachfolder)