tags:

views:

22

answers:

1

I have the following code:

logFile=open('c:\\temp\\mylogfile'+'.txt', 'w')
pprint.pprint(dataobject)

how can i send the contents of dataobject to the log file on the pretty print format ?

+2  A: 
pprint.pprint(dataobject, logFile)

See the documentation

livibetter