-
Notifications
You must be signed in to change notification settings - Fork 0
/
block_status.py
29 lines (26 loc) · 1.09 KB
/
block_status.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
# -*- coding: cp1251 -*-
# Ñêðèïò ïîêàçûâàåò èñòîðèþ áëîêèðîâêè ïî êàðòå â r6
import subprocess as sp
import fnmatch
import os
import sys
#2. buld SET of identifyed cards
bc_root_folder=r"C:\Share_transport\LINK\MINSOC\R6"
card = int(input('Íîìåð êàðòû:'))
tree = os.walk(bc_root_folder) #äåðåâî ïàïîê è ôàéëîâ â îáúåêòå-ãåíåðàòîðå
for d in tree:
for f in d[2]:
#print (os.path.join(d[0],f)) #ñïèñîê ôàéëîâ ñ ïîëíûì ïóòåì
if fnmatch.fnmatch(f, 'r6_*.csv'): #ôèëüòð ôàéëîâ ïî ìàñêå - r6
cur_file=open(os.path.join(d[0],f)) #îòêðûâàåì îòîáðàíûé ôàéë
cur_file_text = cur_file.read()
cur_file_ls = cur_file_text.split('\n') #ðàçäåëÿåì íà îòäåëüíûå ñòðîêè
for s in cur_file_ls: #öèêë ïî êàæäîé ñòðîêå
cur_str = s.split(';')
if len(cur_str[0])>4: #îòñåêàåì ïóñòûå ñòðîêè
try:
#print (card, d[2], cur_str[0:])
if int(cur_str[0])==card:
print (card, f, cur_str[1:])
except:
print ('Îøèáêà â ôàéëå: ',os.path.join(d[0],f))