![]() |
DeprecationWarning Any Fix for this - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: DeprecationWarning Any Fix for this (/thread-26240.html) |
DeprecationWarning Any Fix for this - Calli - Apr-24-2020 from collections import Iterable def flatten(items, ignore_types=(str, bytes)): for x in items: if isinstance(x, Iterable) and not isinstance(x, ignore_types): yield from flatten(x) else: yield x items = [1, 2, [3, 4, [5, 6], 7], 8] for x in flatten(items): print(x)Error Respond code DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import Iterable RE: DeprecationWarning Any Fix for this - buran - Apr-24-2020 what other fix than the one suggested in the warning itself???? RE: DeprecationWarning Any Fix for this - Calli - Apr-24-2020 Thanks |