code style/efficiency question: text file templates

Chris
Sat Aug 3 21:15:00 EDT 2002


simple stuff here.

If I want to generate 100 subtly different templated HTML pages that
are each about 150 lines long, do you think it better (efficiency
and/or style) to create one file, then read, modify necessary parts,
and save as new file name, or to run through a loop of 150
file.write('') for each file name?  

So either I read the 150 lines and replace strings, or write 150
lines.

The page to page deviations are minor (one image name, one caption
string from image name).  I was assuming I would do the latter, but
the former occurred to me tonight.  Either way I obviously have to
devise and type the HTML code once, obviously.

Saving femtoseconds isn't critical, but I'd like to get some real
programmers' views on which is better and maybe learn some higher
principle.

Thx,
C



More information about the Python-list mailing list