# -*- coding: utf-8 -*- # @Time : 2022/2/10 上午10:08 # @Author : lizhichao # @Email : 13652030758@163.com # @File : sort_Fqfile.py # @Software: PyCharm import sys def removeblank(fqlist): fqlist.remove("") if "" in fqlist: removeblank(fqlist) def sort_fqseq(fqpath,output): with open(fqpath,"r") as fqp,open(output,"w") as ot: content=fqp.readline() for line in fqp: linelist=line.strip().split(",") headdomain=linelist[:4] rawfqlist=linelist[4:] if "" in rawfqlist: removeblank(rawfqlist) fqlist=sorted(rawfqlist) content+="%s\n"%(",".join(headdomain+fqlist)) ot.write(content) if __name__=="__main__": fqpath=sys.argv[1] output=sys.argv[2] sort_fqseq(fqpath,output)