DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Print To A File

  • submit to reddit
        To print to console, it's easy
print 'hello', 'world'
To print to an output file, it's similar
f = open('out.txt','w')
print >>f, 'hello', 'world'