On Fri, Apr 27, 2012 at 8:37 PM, Tim Wintle <tim.win...@teamrubber.com> wrote: > Or like: > >>>> print [ 0 if b%2==1 else 1 for b in range(10)] > [1, 0, 1, 0, 1, 0, 1, 0, 1, 0]
That's nothing to do with the list comp, that's just the expression-if syntax that you can use anywhere. ChrisA -- http://mail.python.org/mailman/listinfo/python-list