[Python-Dev] Adding start to enumerate() (original) (raw)
Jesus Cea jcea at jcea.es
Tue May 13 21:14:44 CEST 2008
- Previous message: [Python-Dev] Adding start to enumerate()
- Next message: [Python-Dev] Adding start to enumerate()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
-----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-----
- Previous message: [Python-Dev] Adding start to enumerate()
- Next message: [Python-Dev] Adding start to enumerate()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]