How to chunk a list in Python 3?

In Python 3’s itertools there is a function called zip_longest. It should do the same as izip_longest from Python 2.

Why the change in name? You might also notice that itertools.izip is now gone in Python 3 – that’s because in Python 3, the zip built-in function now returns an iterator, whereas in Python 2 it returns a list. Since there’s no need for the izip function, it also makes sense to rename the _longest variant for consistency.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)