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

    3 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. 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 …

  4. For loop and zip in python - Stack Overflow

    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 understanding how …

  5. 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 …

  6. 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.

  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 - Download Returned Zip file from URL - Stack Overflow

    Feb 23, 2012 · If I have a URL that, when submitted in a web browser, pops up a dialog box to save a zip file, how would I go about catching and downloading this zip file in Python?

  9. How to zip a file in python? - Stack Overflow

    Feb 26, 2022 · 7 I have been trying to make a python script to zip a file with the zipfile module. Although the text file is made into a zip file, It doesn't seem to be compressing it; testtext.txt is 1024KB whilst …

  10. Safely extract uploaded ZIP files in Python - Stack Overflow

    Apr 28, 2025 · 2 I'm working on a python REST API that allows users to upload ZIP files. Before extracting them, I want to protect against common vulnerabilities, especially Zip bombs. Is there a …