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

后端 未结 3 1733
时光说笑
时光说笑 2021-02-11 16:30

I have a problem that I want to solve with itertools.imap(). However, after I imported itertools in IDLE shell and called itertools.imap(), the IDLE shell told me that itertools

3条回答
  •  旧时难觅i
    2021-02-11 17:11

    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()).

提交回复
热议问题