Python zip function takes in iterables as arguments and creates an iterator.
A simple working example.
list of columns
columns = ["id","name","age","city","country"]
list of values
values = [111,"Mary John",35,"New York","USA"]
create an iterator with the zip function that takes in columns, values as the input parameters
zipped = zip(columns, values)
type(zipped) returns the value as zip
display the values
list(zipped)
Empty zip declaration
zipped = zip()
Top comments (0)