Jeffrey Schwab wrote: > [EMAIL PROTECTED] wrote: ... >> def genpage(arg1,arg2): >> print ''' <div align="right"><font size="-1">BLAH BLAH.....%s %s >> ''' % (arg1, arg2) ... >> .... i wish to print all these into a HTML output file so that >> when i click on it, it shows me the html page. How can i do that? > ... > Why not just redirect the output of your Python script from the shell? > E.g.: > > python generate_html.py > output.html
Or you can even do the following Python dance: def gen_to_file(filename, arg1, arg2): import sys former, sys.stdout = sys.stdout, open("output.html", "w") try: genpage(arg1, arg2) finally: htmlfile, sys.stdout = sys.stdout, former htmlfile.close() print 'file %r written' % filename --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list