Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-18 Thread William Pursell
On Feb 14, 6:54 am, "W. Watson" <[EMAIL PROTECTED]> wrote: > See Subject. It's a simple txt file, each line is a Python stmt, but I need > up to four digits added to each line with a space between the number field > and the text. Perhaps someone has already done this or there's a source on > the we

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-18 Thread Michael Wronna
On Thu, 14 Feb 2008, W. Watson wrote: > See Subject. It's a simple txt file, each line is a Python stmt, but I need > up to four digits added to each line with a space between the number field > and the text. Perhaps someone has already done this or there's a source on > the web for it. I'm n

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-18 Thread thebjorn
On Feb 15, 8:55 pm, Jeff Schwab <[EMAIL PROTECTED]> wrote: > W. Watson wrote: > > See Subject. It's a simple txt file, each line is a Python stmt, but I > > need up to four digits added to each line with a space between the > > number field and the text. Perhaps someone has already done this or > >

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-17 Thread JussiJ
On Feb 14, 5:54 pm, "W. Watson" <[EMAIL PROTECTED]> wrote: > See Subject. It's a simple txt file, each line is a Python stmt, > but I need up to four digits added to each line with a space > between the number field and the text. FWIW here is a Zeus editor, Python macro script to do this: im

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-15 Thread Jeff Schwab
W. Watson wrote: > See Subject. It's a simple txt file, each line is a Python stmt, but I > need up to four digits added to each line with a space between the > number field and the text. Perhaps someone has already done this or > there's a source on the web for it. I'm not yet into files with P

Re: [OT] Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-15 Thread Steve Holden
I'll see your IBM 650 and raise you a Univac 418 with a FastRand drum. regards Steve W. Watson wrote: > Good grief! You go a long way back. Want to try for an IBM 650 with a drum > memory? > > Gabriel Genellina wrote: >> En Thu, 14 Feb 2008 04:54:56 -0200, W. Watson <[EMAIL PROTECTED]> >> es

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-15 Thread Steve Holden
[EMAIL PROTECTED] wrote: >> See Subject. It's a simple txt file, each line is a Python stmt, but I need >> up to four digits added to each line with a space between the number field >> and the text. Perhaps someone has already done this or there's a source on >> the web for it. I'm not yet into fil

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-15 Thread [EMAIL PROTECTED]
> See Subject. It's a simple txt file, each line is a Python stmt, but I need > up to four digits added to each line with a space between the number field > and the text. Perhaps someone has already done this or there's a source on > the web for it. I'm not yet into files with Python. A sudden need

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-15 Thread Steve Holden
W. Watson wrote: > Thanks. I found this to work: > > input_file=open('junkin.txt','r') > output_file=open('junkout.txt','w') > for (line_cnt, each_line) in enumerate(input_file): > output_file.write('%4d '%(line_cnt+1)+each_line) You can improve this slightly by using string formatting more

Re: [OT] Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-14 Thread Gabriel Genellina
> Gabriel Genellina wrote: >> En Thu, 14 Feb 2008 04:54:56 -0200, W. Watson <[EMAIL PROTECTED]> >> escribió: >> >>> See Subject. It's a simple txt file, each line is a Python stmt, but I >>> need >>> up to four digits added to each line with a space between the number >>> field >>> and the text. >

Re: [OT] Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-14 Thread Jaap Spies
Gabriel Genellina wrote: > En Thu, 14 Feb 2008 04:54:56 -0200, W. Watson <[EMAIL PROTECTED]> > escribió: > >> See Subject. It's a simple txt file, each line is a Python stmt, but I >> need >> up to four digits added to each line with a space between the number >> field >> and the text. Perhaps

Re: [OT] Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-14 Thread W. Watson
Good grief! You go a long way back. Want to try for an IBM 650 with a drum memory? Gabriel Genellina wrote: > En Thu, 14 Feb 2008 04:54:56 -0200, W. Watson <[EMAIL PROTECTED]> > escribió: > >> See Subject. It's a simple txt file, each line is a Python stmt, but I >> need >> up to four digits a

[OT] Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-14 Thread Gabriel Genellina
En Thu, 14 Feb 2008 04:54:56 -0200, W. Watson <[EMAIL PROTECTED]> escribió: > See Subject. It's a simple txt file, each line is a Python stmt, but I > need > up to four digits added to each line with a space between the number > field > and the text. Perhaps someone has already done this or

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-14 Thread J Peyret
On Feb 14, 8:50 am, "W. Watson" <[EMAIL PROTECTED]> wrote: (snip) > I thought this might be more difficult judging by a long ago experience with > Java. (snip) +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-14 Thread W. Watson
Thanks. I found this to work: input_file=open('junkin.txt','r') output_file=open('junkout.txt','w') for (line_cnt, each_line) in enumerate(input_file): output_file.write('%4d '%(line_cnt+1)+each_line) output_file.close() input_file.close() I removed the print, but ran into trouble with zfill

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-14 Thread Chris
On Feb 14, 1:29 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Feb 14, 6:13 pm, Chris <[EMAIL PROTECTED]> wrote: > > > > > On Feb 14, 8:54 am, "W. Watson" <[EMAIL PROTECTED]> wrote: > > > > See Subject. It's a simple txt file, each line is a Python stmt, but I > > > need > > > up to four digits a

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-14 Thread John Machin
On Feb 14, 6:13 pm, Chris <[EMAIL PROTECTED]> wrote: > On Feb 14, 8:54 am, "W. Watson" <[EMAIL PROTECTED]> wrote: > > > See Subject. It's a simple txt file, each line is a Python stmt, but I need > > up to four digits added to each line with a space between the number field > > and the text. Perhap

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-13 Thread Chris
On Feb 14, 8:54 am, "W. Watson" <[EMAIL PROTECTED]> wrote: > See Subject. It's a simple txt file, each line is a Python stmt, but I need > up to four digits added to each line with a space between the number field > and the text. Perhaps someone has already done this or there's a source on > the we

Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-13 Thread W. Watson
See Subject. It's a simple txt file, each line is a Python stmt, but I need up to four digits added to each line with a space between the number field and the text. Perhaps someone has already done this or there's a source on the web for it. I'm not yet into files with Python. A sudden need has