美文网首页
2018-06-10海冬找差集&乐乐找交集

2018-06-10海冬找差集&乐乐找交集

作者: keaidelele | 来源:发表于2018-06-10 22:24 被阅读6次
    import os
    import glob
    
    root = 'out'
    cazyme= '/storage/CAZYme1'
    list1 = []
    list2 = []
    files1 = glob.glob('out/*.txt.diamond_pdb')
    for one in files1:
        list1.append(one.split('.')[0].split('/')[-1])
    files2 = glob.glob('/storage/CAZYme1/*.txt')
    for one in files2:
        list2.append(one.split('.')[0].split('/')[-1])
    print(list2)
    
    print(len(list1))
    print(len(list2))
    
    print (set(list2).difference(set(list1)))
    
    

    ps:小服务器上面的python的strip函数好像有点问题,最好用别的函数比如split()

    import os
    import copy
    mydir = 'scan_total'
    fungi_dir = '../fungi'
    
    fungi_dirs = os.listdir(fungi_dir)
    list1 = []
    for roots, dirs, files, in os.walk(mydir):
        files1 = copy.deepcopy(files)
        for onefile in files:
            filename = onefile.split("_all")[0]
            list1.append(filename)
    print (set(fungi_dirs)^set(list1))
    
    

    相关文章

      网友评论

          本文标题:2018-06-10海冬找差集&乐乐找交集

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