pprint and ">>>"

Skip Montanaro skip at pobox.com
Wed Sep 24 14:34:32 EDT 2003


    Shu-Hsien> Sometimes, it is find of nice using: print >> my_file_object,
    Shu-Hsien> my_variabels than using the standard f.write.  However, it
    Shu-Hsien> cannot be done with pprint.pprint.

Actually, yes you can.  Pprint.pprint() takes an optional second argument
which specifies the stream to write to.  It defaults to sys.stdout.

Skip





More information about the Python-list mailing list