hi,
i have a text file(as below). how to check if there is -1, print out which lane is it and fail it. Eg: FAIL Lane 4. My code is like this, but only check whether there is -1 in the file.
=============== =========Code== =============== ============
=============== =====Data====== =============== ============
Platform: PC
Tempt : 25
TAP0 :0
TAP1 :1
+++++++++++++++ +++++++++++++++ +++++++++++++++
Port Chnl Lane EyVt
+++++++++++++++ +++++++++++++++ +++++++++++++++
0 1 1 75
0 1 2 55
0 1 3 65
0 1 4 -1
0 1 5 20
+++++++++++++++ +++++++++++++++ +++++++++++++++
Time: 20s
thanks
maximus
i have a text file(as below). how to check if there is -1, print out which lane is it and fail it. Eg: FAIL Lane 4. My code is like this, but only check whether there is -1 in the file.
=============== =========Code== =============== ============
Code:
print
fname = raw_input('Enter filename: ')
pattern = raw_input('Enter pattern: ')
def findPattern(fname, pat):
f = open(fname, "r")
for line in f:
if pat in line:
print "Fail"
break
else:
print "Pass"
findPattern(fname, pattern)
Platform: PC
Tempt : 25
TAP0 :0
TAP1 :1
+++++++++++++++ +++++++++++++++ +++++++++++++++
Port Chnl Lane EyVt
+++++++++++++++ +++++++++++++++ +++++++++++++++
0 1 1 75
0 1 2 55
0 1 3 65
0 1 4 -1
0 1 5 20
+++++++++++++++ +++++++++++++++ +++++++++++++++
Time: 20s
thanks
maximus
Comment