John Washakie wrote:
> I can't recall how to do this:
> 
> I want:
> a  = [int(x) for x in tmp]
> 
> but, my tmp has some empty elements, so it fails...
> 
> Therefore I want to be able to say:
> 
> a = [int(x) for x in tmp IF x in tmp]

That's almost right, except it checks the wrong thing. Try
a  = [int(x) for x in tmp if x]

Depending on what an 'empty' element is you may have to refine that.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to