I want your awesome python snippets.

by jesse in ,

I'm building (and will eventually post someplace) a collection of the cooler Python snippets I dredge up. I'm looking for snippets which are:

  • Short
  • New-to-Python accessible
  • Showcase the best ideas of python - clean, simple, powerful.

The goal is to build up a small pile of code snippets that programming newbies, or programmers from other languages can look at and go "wow, I got to get me some of that".

Anything is game; feel free to post them in the comments, on pastebin (obviously post the link), etc.