On May 7, 12:01 am, [EMAIL PROTECTED] wrote: > Hey, > > I'm writing a script to generate code. I'm a bit tired of typing > outfile.write(....). Does python have a way to c-like macros? Every > instance of o(...) in the code will be replaced by outfile.write(...)? All in Python is pointer to object, and functions too, so
o = outfile.write o("Some Text") You can redirect print to file also: print >> outfile, "Text", var1, var2[2:] or o = outfile print >> o, "Text", var1, var2[2:] :) -- http://mail.python.org/mailman/listinfo/python-list