Amazon.com Widgets Python showboating | t+1: Matt Wilson's blog

Python showboating

Some javascript sends a string like this: a_1_b_2_c_3, so here’s how I parse it:

>>> s
'a_1_b_2_c_3'
>>> a, b, c = [int(x) for x in s.split('_')[1::2]]
>>> a, b, c
(1, 2, 3)

More seriously, this guy’s post on why zip is the same as unzip blew my mind.