[Tutor] Re: Readlines
Derrick 'dman' Hudson
dman@dman13.dyndns.org
Thu Jun 26 16:03:04 2003
--0vzXIDBeUiKkjNJl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Mon, Jun 23, 2003 at 03:26:13PM -0230, Adam Vardy wrote:
| Sunday, June 22, 2003, 5:07:23 AM, you wrote:
|=20
| >> for line in f.xreadlines():
| >> print line
|=20
| How do you tell what line it is on there?
You don't care, there. Many times when reading a file it is the
content of the line that is important, not how far into the file the
line is. xreadlines() is a shortcut that allows you to skip the
business with a counter or testing for end-of-file and just get to the
important aspect of handling the data in the file.
-D
--=20
Yes, Java is so bulletproofed that to a C programmer it feels like being in=
a
straightjacket, but it's a really comfy and warm straightjacket, and the wo=
rld
would be a safer place if everyone was straightjacketed most of the time.
-- Mark 'Kamikaze' Hu=
ghes
=20
http://dman13.dyndns.org/~dman/
--0vzXIDBeUiKkjNJl
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAj77UUwACgkQiB6vp1xAVUCQJQCdEWJRRn+FQ8Hm2nv0oawqF7fO
ogkAoJC0d025ZZu2G8uUW2IFSl00Wxkk
=fqVR
-----END PGP SIGNATURE-----
--0vzXIDBeUiKkjNJl--