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
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
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
> >
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
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
[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
> 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
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
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
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
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
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
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
13 matches
Mail list logo