About 50 results
Open links in new tab
  1. Zip lists in Python - Stack Overflow

    23 In Python 3 zip returns an iterator instead and needs to be passed to a list function to get the zipped tuples:

  2. Why does x,y = zip(*zip(a,b)) work in Python? - Stack Overflow

    I'm extremely new to Python so this just recently tripped me up, but it had to do more with how the example was presented and what was emphasized. What gave me problems with understanding the …

  3. python - Difference between zip (list) and zip (*list) - Stack Overflow

    Mar 19, 2015 · zip([1,2,3],[4,5,6]) Also, note that since Python-3.5 you can use unpacking operators in a few other cases than in function callers. One of which is called in-place unpacking that lets you use …

  4. For loop and zip in python - Stack Overflow

    Apr 12, 2018 · Q1- I do not understand "for x, y in zip (Class_numbers, students_per_class)". Is it like a 2d for loop? why we need the zip? Can we have 2d loop with out zip function? Q2-I am not …

  5. How does zip(*[iter(s)]*n) work in Python? - Stack Overflow

    11 iter(s) returns an iterator for s. [iter(s)]*n makes a list of n times the same iterator for s. So, when doing zip(*[iter(s)]*n), it extracts an item from all the three iterators from the list in order. Since all the …

  6. Python equivalent of zip for dictionaries - Stack Overflow

    Python equivalent of zip for dictionaries Asked 12 years, 9 months ago Modified 1 year, 7 months ago Viewed 67k times

  7. python - Make a dictionary (dict) from separate lists of keys and ...

    In Python 3, zip now returns a lazy iterator, and this is now the most performant approach. dict(zip(keys, values)) does require the one-time global lookup each for dict and zip, but it doesn't form any …

  8. Python iterator and zip - Stack Overflow

    Jun 25, 2016 · So it's the same thing as zip(*[i, i]) (it's just more convenient to write when you want to repeat something many more than 2 times). * unpacking is a common idiom in python and you can …

  9. python - How to create a zip archive of a directory? - Stack Overflow

    Dec 6, 2009 · 69 How can I create a zip archive of a directory structure in Python? In a Python script In Python 2.7+, shutil has a make_archive function.

  10. python - understanding zip function - Stack Overflow

    Oct 5, 2010 · All discussion is about python 3.1.2; see Python docs for the source of my question. I know what zip does; I just don't understand why it can be implemented like this: def zip(*iterables): # zip('