美文网首页
python查找缺失文件

python查找缺失文件

作者: Aerosols | 来源:发表于2020-02-01 19:14 被阅读0次
    import numpy as np
    import os,sys
    
    filepath=r'F:\gucheng\20191212d'
    numfile=4163
    fn1=r'F:\gucheng\20191212d\20191212x'
    fn3='.dat'
    nlist=range(1,numfile+1)
    
    for i in nlist:
        
        if i<10:
            filename=fn1+'00'+str(i)+fn3
        elif (i>=10 and i<=99):
            filename=fn1+'0'+str(i)+fn3
        else:
            filename=fn1+str(i)+fn3
              
        ans = os.path.exists(filename)
        
        if not ans:
           print(filename)
    

    相关文章

      网友评论

          本文标题:python查找缺失文件

          本文链接:https://www.haomeiwen.com/subject/prvxxhtx.html