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))
网友评论