I can't find imap() in itertools in Python

itertools.imap() is in Python 2, but not in Python 3.

Actually, that function was moved to just the map function in Python 3 and if you want to use the old Python 2 map, you must use list(map()).


If you want something that works in both Python 3 and Python 2, you can do something like:

try:
    from itertools import imap
except ImportError:
    # Python 3...
    imap=map

You are using Python 3, therefore there is no imap function in itertools module. It was removed, because global function map now returns iterators.