Tôi có một vấn đề mà tôi muốn giải quyết với itertools.imap(). Tuy nhiên, sau khi tôi nhập khẩu các itertools trong trình bao IDLE và được gọi là itertools.imap(), trình bao IDLE đã nói với tôi rằng các itertools không có thuộc tính imap. Có chuyện gì vậy?Tôi không thể tìm thấy imap() trong itertools trong Python
>>> import itertools
>>> dir(itertools)
['__doc__', '__loader__', '__name__', '__package__', '__spec__', '_grouper', '_tee', '_tee_dataobject', 'accumulate', 'chain', 'combinations', 'combinations_with_replacement', 'compress', 'count', 'cycle', 'dropwhile', 'filterfalse', 'groupby', 'islice', 'permutations', 'product', 'repeat', 'starmap', 'takewhile', 'tee', 'zip_longest']
>>> itertools.imap()
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
itertools.imap()
AttributeError: 'module' object has no attribute 'imap'
Bạn cũng có thể xem [itertools.starmap] (https://docs.python.org/3.6/library/itertools.html#itertools.starmap) trong pyhton3. –