按_1 _2 排序fqlist 递归去空格

# -*- 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)

  

上一篇:MySQL的数据库产品、SQL语言、MySQL的特点(2月23日)


下一篇:hashing-hard version 自己的想法