python14

2021-08-11  本文已影响0人  rong酱
# -*- coding: utf-8 -*-
#!/usr/bin/env python

import os
import sys

in1 = sys.argv[1]
in2 = sys.argv[2]
ou1 = sys.argv[3]

dictin1 = {}
with open(in1,"r") as in1ss:
    in1s = in1ss.readlines()
    for in1l in in1s[1:]:
        in1li = in1l.strip().split("\t")
        dictin1[in1li[0]] = in1li[1]

outcon = open(ou1,"w")
with open(in2,"r") as in2ss:
    in2s = in2ss.readlines()
    for in2l in in2s[1:]:
        in2li =  in2l.strip().split("\t")
        if in2li[0] in dictin1.keys():
            outcon.write(str(in2li[0])+"\t"+str(in2li[1])+"\t"+str(dictin1[in2li[0]])+"\n") 

一直用这几个用法,好无聊,没有长进

上一篇 下一篇

猜你喜欢

热点阅读