pprint and ">>>"

Shu-Hsien Sheu sheu at bu.edu
Wed Sep 24 13:21:45 EDT 2003


Hi,

Sometimes, it is find of nice using:
print >> my_file_object, my_variabels
than using the standard f.write.
However, it cannot be done with pprint.pprint.
I understand that i can do it by redirecting the sys.stdout, but isn't 
it nice if I can do something like pprint.pprint >> my_file_object, 
my_dictionary?

BTW, the syntax
print >> my_file_object, my_variables
seems a bit awkward to me.
Isn't it better if we can simply use:
print *whatever_this_is >> my _file_object
just like the way we do in unix shell?

-shuhsien






More information about the Python-list mailing list