[Python-Dev] Adding start to enumerate()
Jesus Cea
jcea at jcea.es
Tue May 13 21:14:44 CEST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Greg Ewing wrote:
| Steven D'Aprano wrote:
|> The only thing I can think of is printing lines with line numbers
|
| Parsing a file and wanting to be able to print
| error messages with line numbers would seem to
| be a fairly likely use.
What is wrong with:
for lineno,line in enumerate(file) :
~ print lineno+1,line
:-?
- --
Jesus Cea Avion _/_/ _/_/_/ _/_/_/
jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/
jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/_/_/_/
~ _/_/ _/_/ _/_/ _/_/ _/_/
"Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/
"My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iQCVAwUBSCnopJlgi5GaxT1NAQJSAAP/V8U23owV+YjGiAKQbZOb6FIXA6Wfll65
/oLg1WuzQ/KBre41LJ3sw4RS8+FThrfihe56nYmJagnkvo353rceb/W45T85b17Y
+VXg33jQy8UkoJX2a0YwFP8jZPO+5iWlO6zUc44iisBmh8BeLCMQAJHl6+0pJfqQ
/cp/BLcxEYI=
=T1Bc
-----END PGP SIGNATURE-----
More information about the Python-Dev
mailing list