-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormatCheck.py
31 lines (27 loc) · 1010 Bytes
/
FormatCheck.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
import sys;
def Check(name):
f=open(name);
Names=["5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","A2","A3","A4","A5","A6","A7","A8","A9","22","33","44","55","66","77","88","99","1010","AA"];
Options=["H","D","S","P"];
if(not(len(f.readlines()) == len(Names))):
print("Incorrect Number of Lines");
return False;
cou=0;
for l in f.readlines():
sp=l.strip().split('\t');
if(not(sp[0]==Names[cou]) or not(len(sp)==2)):
print("Line Format Incorrect");
return False;
sp= [ob in Options for ob in sp[1].split()];
if(not(len(sp)==10)):
print("Line Format Incorrect");
return False;
return True;
def main():
if(not(len(sys.argv) == 2)):
print("Exactly one command line argument required");
sys.exit();
else:
print(Check(sys.argv[1]));
if __name__ == "__main__":
main()