Removing leading zeroes in Python's strftime

Update: See the comment below from aloschilov for the best way to removing leading zeroes, which is to use a - before the formatter (after the %), e.g.: %-H. I was unaware of this syntax when I wrote this tip.

Python's strftime does not have options for single digit days or hours, which means you can end up with very clinical looking formats like:

02:24 PM - 09 Jan 2014

A simple way to fix this is to combine the power of strftime and regular string formatting. Along with a little mod trickery, you can get more human friendly looking formats this way: