> >Just create the string outsoide the formatting line:
> >
> >fmtString = '%%ds' % width
>
> I think it should be '%%%ds' % width
Good catch Bob, you need the extra % to 'escape' the literal %
character.
Alan G.
___
Tutor maillist - Tutor@python.org
At 02:58 PM 5/27/2005, Alan G wrote:
> 1. how can I format outfile
so i can write multiple lines
> and then apend multiple lines later before closing the
file?
I think you mean add a new column to the existing lines?
try something like
line = line + '%25s' % newdata
> 2. how can I make data forma
1. how can I format outfile so i
can write multiple lines
and then apend multiple lines later before closing the
file?
It sounds like you want to update the file in successive passes. This is
hard or impossible. Your best bet is to read one file and write
another.
2. how can I make data
formatti
> 1. how can I format outfile so i can write multiple lines
> and then apend multiple lines later before closing the file?
I think you mean add a new column to the existing lines?
try something like
line = line + '%25s' % newdata
> 2. how can I make data formatting string '%25s' intiger (in thi
>Content-Type: text/html; format=flowed
>
>
[...]
What a mess.
You should to post to the list in plain text.
Someone might take the time to weed through that for your
question, but you will get a lot more help and a lot sooner
if you just configure your mailer to send plain text.
__
I am trying to write to a file multiple times before close. Using the following sequence:
outfile = open(data_file, 'w' )
x=5
while x > 0
x = x - 1
datax is read from a file.
outfile.write('%25s' %datax + "|\n")
This loop will write 5 lines at column position 25. I later come back to the sam