[Tutor] Formatted writing to a file

Bob Gailer bgailer at sbcglobal.net
Sat May 28 00:15:10 CEST 2005


>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 formatting string '%25s' intiger (in this
>case 25) a variable?

Use %*s. Assuming width = 25:
%25s' % 3 == '%*s' % (width, 3)

Bob Gailer
mailto:bgailer at alum.rpi.edu
510 558 3275 home
720 938 2625 cell  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050527/ff9e2a69/attachment.htm


More information about the Tutor mailing list