converting from perl: variable sized unpack

Alex new_name at mit.edu
Sat Jul 14 10:55:54 EDT 2001


> > [f1, f2, f3, f4, f5, f6] = (string.split (line) + 6*[None])[:6]
> 
> Yeah, that's what I had come up with, but I was hoping somebody would have 
> an idea that was more elegant and efficient :-)

Why not just leave it as a list and work with the elements?  

f = line.split()

Alex.



More information about the Python-list mailing list