Please excuse the double post, I had a problem with my email program.
tee chwee liong wrote:
hi,
i have a sampledata as below. Pls refer to output, if found -1, how to list out
all the Lane number? And if there is no -1, print PASS. My code is as below
section.
####Code####################
fname = "sampledata.txt"
pattern = "-1"
for search in open(fname):
if pattern in search:
print "FAIL"
else:
print "PASS"
fname = "sampledata.txt"
pattern = "-1"
failed = False
for line in open(fname):
port, channel, lane, eyvt = line.split()
if int(eyvt) == -1:
failed = True
print "Lane %s failed." % lane
if not failed:
print "All lanes pass."
--
Steven
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor