Danny Yoo wrote:
It also makes it easier to see a possible bug in the code: the last few
lines in the 'for' loop look suspicious:

######
        txt = textile(tmp) + '</body></html>'
        t = Template(txt)
        s = t.safe_substitute(title='Web-siter: %s' % i[:-5])
        output = open(page, 'w')
        output.write('')
        output.write(s)
######

It does look strange that the file is being open and rewritten over and
over, for each line in the file.  Are you sure you want to put that in the
body of the loop?

You are also passing the text through textile / Template / safe_substitute repeatedly. You probably want to accumulate all the text, process it once and write it to the file.


Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to