linecache and comparison with input

Ross Hetherington ross at heth.eclipse.co.uk
Sat Jun 30 10:32:22 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Sebastian Wiesner wrote:
> 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.

Ah, thank you. I did notice that getline left a trailing newline, but I
didn't realise raw_input didn't. Ooops.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFGhml20HlvQApfM3gRCozzAJ0QAENDkQn8StlEr9Mh0yoCCkUhzQCcCmOC
5tPusqS4MwnisNLZmtKc3Y4=
=hlHr
-----END PGP SIGNATURE-----



More information about the Python-list mailing list