python9

作者: rong酱 | 来源:发表于2021-06-10 15:54 被阅读0次
    # -*- coding: utf-8 -*-
    
    file1 = sys.argv[1]
    file2 = sys.argv[2]
    outfile = sys.argv[3]
    outcon = open(outfile,"w")
    
    dictfile1 = {}
    with open(file1,"r")  as file1liness:
        file1lin = file1liness.readlines()
        for file1lines in file1lin:
            file1line = file1lines.strip().split("\t")
            file1key = file1line[0]
            file1apapos = file1line[1]
            dictfile1[file1key] = file1apapos
    
    with open(file2,"r") as file2liness:
        file2lin = file2liness.readlines()
        for file2lines in file2lin:
            file2line = file2lines.strip().split("\t")
            file2key = file2line[0]
            file2apapos = file2line[1]
            if file2key in dictfile1.keys():
                fil1value = dictfile1[file2key]
                outcon.write(str(file2key)+'\t'+str(fil1value)+'\t'+str(file2apapos)+'\n')
    
    

    相关文章

      网友评论

          本文标题:python9

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