搜索数据

!/bin/env python

import os

获取数据信息

ss = open(‘/tmp/number_list’,’r’)

打开文件信息

f = open(‘/upload/storage/backup_record/20180526/jss1’,’w’)

循环处理数据

for i in ss.readlines():
j = i.split()

#处理数据,获取固定信息

if len(j) != 2:
continue
ss = os.popen(‘grep ‘+ j[0] + ’ call_record2018-05-26.csv | grep -o -e ’ + j[1] + ’ |head -1’)
if ss.read().rstrip(“\n”) :
reslut = str(ss.read().rstrip(“\n”)) + ” ” + str(j[0]) + “\n”
f.writelines(reslut)
else :
print str(j[0])

关闭打开的文件

f.close()
ss.close()

猜你喜欢

转载自blog.csdn.net/m0_38073247/article/details/82184950
今日推荐