-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4-10_GLcode.py
49 lines (34 loc) · 1.17 KB
/
4-10_GLcode.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
GLcode = input("AccountID")
#asks for user to request an account ID
GLlines = []
#starts an empty array
infile = open("G:\school\Python\\ForS4.txt","r")
s = infile.readline()
readStage = 0 #not to read yet, just pass
while not s.startswith("GLDataEnd"):
#while GLData hasn't ended yet,
if s.startswith("GLDataStart"):
readStage = 1 #standby for title read in
elif readStage == 1:
header = s.split("|")
#read all the headers/titles and store in header[], then increment
readStage += 1
elif readStage > 1:
GLlines.append(s)
#add s to GLines
s = infile.readline()
#get a new s
print(readStage)
for i in range(len(header)):
print(header[i],end = "\t")
#end with a \t each time instead of the default \n
print("\n")
for line in GLlines:
ss = line.split("|")
#for everything inside GLData, store into an array ss
if ss[header.index("AccountID")]==GLcode:
#only print if ss fits the GLcode input by the user
for i in range(len(ss)):
print(ss[i], end = "\t")
print("\n")
infile.close()