r/Python • • Feb 28 '13

What's the one code snippet/python trick/etc did you wish you knew when you learned python?

I think this is cool:

import this

259 Upvotes

307 comments sorted by

View all comments

Show parent comments

5

u/KitAndKat Feb 28 '13

As one line:

from pprint import pprint as print

1

u/westurner Mar 06 '13
from __future__ import print_function # < python 3
print(*objects, sep=' ', end='\n', file=sys.stdout)

import pprint
pprint.pprint(object, stream=None, indent=1, width=80, depth=None)