"Dick Moores" <[EMAIL PROTECTED]> wrote
> lstNums = []
> for x in lstSvg:
> num = int(x.split('.')[0])
> lstNums.append(num)
This is exactly what a list comp does so you could rewrite it as:
lstNums = [int(x.split('.')[0]) for x in lstSvg]
One of the cases where I actually think a list comprehension
is more readable than the expanded code.
> nextSVGnum = max(lstNums) + 1
> return nextSVGnum
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor