[ Ross Hetherington <[EMAIL PROTECTED]> ] > #!/usr/bin/env python > > import random > import sys > import linecache > > rnd = random.randint(1,3) > line = linecache.getline('testfile', rnd) > > print line Try print repr(line) ... > > gss = raw_input('Enter line: ',) and print repr(gss) ;)
> if gss == line: > print 'yes' > sys.exit() > else: > print 'no' > Then you will see, that getline returns the line *including the newline character*, while raw_input does not. Use line.strip('\n') to remove trailing newline characters from the return value of getline. -- Freedom is always the freedom of dissenters. (Rosa Luxemburg)
signature.asc
Description: This is a digitally signed message part.
-- http://mail.python.org/mailman/listinfo/python-list