Here is my codes,I am trying to zip two lists
a = [1,2,3]
b = [4,5,6]
print(zip(a,b))
It just printed the location
Error:
<zip object at 0x10c6b2488>
May i ask why is it so?
zip function returns a zip object, which is an iterator. Iterators are a somewhat broader subject, but you can find an overview to catch up, such as
this one.
If you want to display the zip object as a list, convert it to a list with:
print(list(zip(a,b)))
(May-18-2018, 05:10 AM)Tony Wrote: [ -> ]Here is my codes,I am trying to zip two lists a = [1,2,3] b = [4,5,6] print(zip(a,b))
It just printed the location Error:
<zip object at 0x10c6b2488>
May i ask why is it so?
(May-18-2018, 05:20 AM)j.crater Wrote: [ -> ]zip function returns a zip object, which is an iterator. Iterators are a somewhat broader subject, but you can find an overview to catch up, such as this one. If you want to display the zip object as a list, convert it to a list with: print(list(zip(a,b)))
Thank you so much, that helps a lot