所以我的问题是,当其中一个在服务器中找不到文件时,我的代码会崩溃。有没有办法在没有找到文件时跳过查找过程并继续循环。下面是我的代码:
fname = '/Volumes/database/interpro/data/'+uniprotID+'.txt'
for index, (start, end) in enumerate(searchPFAM(fname)):
with open('output_'+uniprotID+'-%s.txt' % index,'w') as fileinput:
print start, end
for item in lookup[uniprotID]:
item, start, end = map(int, (item, start, end)) #make sure that all value is int
if start <= item <= end:
print item
result = str(item - start)
fileinput.write(">{0} | at position {1} \n".format(uniprotID, result))
fileinput.write(''.join(makeList[start-1:end]))
break
else:
fileinput.write(">{0} | N/A\n".format(uniprotID))
fileinput.write(''.join(makeList[start-1:end]))