-
Notifications
You must be signed in to change notification settings - Fork 0
/
getuectp3.py
50 lines (47 loc) · 2.33 KB
/
getuectp3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -*- coding: cp1251 -*-
# Ïîèñê ðàíåå âûäàííûõ ÓÝÊ
# usage: getuectp.py file1
import subprocess as sp
import fnmatch
import os
import sys
if len(sys.argv)==2:
file1 = sys.argv[1]
else:
print (len(sys.argv))
print ('wrong params number ',len(sys.argv), ' , usage: '+str(sys.argv[1])+' file1')
print(sys.argv)
sys.exit
res_file = open('uectp'+file1, 'w') #èòîãîâûé ôàéë
cur_file=open(file1, encoding='cp1251') #îòêðûâàåì îòîáðàíûé ôàéë
j = 0
k = 0
cur_file_ls = [curr_str.rstrip().split(';')[5]+';'+curr_str.rstrip().split(';')[0]+' '
+curr_str.rstrip().split(';')[1][0]
#+ curr_str.rstrip().split(';')[2][0]
+';'
+uec_str.rstrip().split(';')[8]
#+'snils ais'+curr_str.rstrip().split(';')[4]+'snils uec' +uec_str.rstrip().split(';')[4]
+'\n'
for curr_str in cur_file
for uec_str in open(r"uec_201610.csv", encoding='cp1251')
if len(curr_str.rstrip().split(';'))>4
and ((curr_str.rstrip().split(';')[4] == uec_str.rstrip().split(';')[4])
or curr_str.rstrip().split(';')[0].upper()
+curr_str.rstrip().split(';')[1].upper()
+curr_str.rstrip().split(';')[2].upper()
+curr_str.rstrip().split(';')[3]==uec_str.rstrip().split(';')[0].upper()
+uec_str.rstrip().split(';')[1].upper()+uec_str.rstrip().split(';')[2].upper()
+uec_str.rstrip().split(';')[3]
)
]
res_file.writelines(cur_file_ls)
#for curr_str in cur_file:
# j +=1
# cur_str_ls = curr_str.rstrip().split(';') #öèêë ïî êàæäîé ñòðîêå
# for s1 in open(r"C:\Share_transport\UEC\uec_201610.csv"):
# print (file1+' '+str(j)+' '+str(k))
# s1_ls=s1.rstrip().split(';')
# k +=1
# if (cur_str_ls[4]==s1_ls[4]) or (cur_str_ls[0].upper()+cur_str_ls[1].upper()+cur_str_ls[2].upper()+cur_str_ls[3]==s1_ls[0]+s1_ls[1]+s1_ls[2]+s1_ls[3]):
# res_file.write(cur_str_ls[5]+';'+cur_str_ls[0]+' '+cur_str_ls[1][0]+cur_str_ls[2][0]+';'+s1_ls[8]+'\n')