ZIP in Python
- ZIP is a built-in function in Python.
- ZIP function maps the indexes that are same and returns a single iterator object.
- For example:
a = (1,2,3) b= ('A','B','C') c = zip(a,b) print(list(c)) #OR print(tuple(c)) #OR print(dict(c)) #OR print(set(C)) You can use any of the above iterables for presenting final output.
- You can unzip the iterables using zip and * operator. This is one of the ways to unzip.
- After further research I found we can unzip using list comprehension and map().