On Wed, Mar 18, 2009 at 5:26 PM, Alexander Daychilde (Gmail)
<[email protected]> wrote:
> exp_list = []
>
> exp_range = exp.split(":")
>
> min_padding = len(exp_range[0])
>
> for i in range(int(exp_range[0]),(int(exp_range[1])+1)):
>
> exp_list.append('%0*d' % (min_padding, i))
This could be a little cleaner using tuple assignment to get rid of
the subscripting and list comprehension to get rid of the loop:
lower, upper = exp.split(':')
min_padding = len(lower)
exp_list = [ '%0*d' % (min_padding, i) for in in range(int(lower),
int(upper)+1) ]
Kent
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor