Actually the sequences are of the same length. Forgot to mention that.
thanks,
Harlin
--
http://mail.python.org/mailman/listinfo/python-list
If sequences are not same length:
zip truncates to length of shortest input sequence
map(None, seq1, seq2) pads to length of longest seq.
(can't remember what itertools.izip() does)
--
http://mail.python.org/mailman/listinfo/python-list
On Sunday 06 March 2005 13:09, Harlin Seritt wrote:
> for i, f in filelist, self.checkbox:
>if f.get():
> print i
Use:
for i, f in zip(filelist,self.checkbox):
--
--- Heiko.
pgpuQ4Xv4IUj6.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
> Both filelist and self.checkbox are the same size (4 items btw). Is
> there any way to get this done?
Use zip:
a, b = [1,2,3], ['a', 'b', 'c']
for i,j in zip(a,b):
print i,j
Or from itertools izip - which should be slightly more performant and less
memory consuming.
--
Regards,
Diez B.
I am using the following code:
for i, f in filelist, self.checkbox:
if f.get():
print i
I am getting an error:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python23\lib\lib-tk\Tkinter.py", line 1345, in __call__
return self.func(*args)
File "install.