日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

关闭服务器 找不到文件,在服务器上找不到文件时阻止代码崩溃的方法?

發(fā)布時間:2025/3/21 50 豆豆
生活随笔 收集整理的這篇文章主要介紹了 关闭服务器 找不到文件,在服务器上找不到文件时阻止代码崩溃的方法? 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

所以我的問題是當(dāng)其中一個在服務(wù)器中找不到文件時,我的代碼會崩潰。有沒有一種方法可以在沒有找到文件的情況下跳過查找過程并繼續(xù)循環(huán)。

下面是我的代碼:

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]))

總結(jié)

以上是生活随笔為你收集整理的关闭服务器 找不到文件,在服务器上找不到文件时阻止代码崩溃的方法?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。