Python eterable

Asked 2 years ago, Updated 2 years ago, 19 views

I'm a beginner who started studying Python, and the Python for statement tells me to write an iterable object after the in.However, a set type that is not interable can be written after the in.Also, the frozen function that generates the frozen set can be generated even though the argument is interchangeable.What should I think?

python

2022-09-30 19:34

1 Answers

The set and frozenset types are iterable.The object that displays True in the following code is iterable.

s=set()
try:
    iterator=iter(s)
    print(True)
exceptTypeError as:
    print(False)

iterableAbout Terminology—Python 3.7.2 Documentation
iterAbout Embedded Functions—Python 3.7.2 Document


2022-09-30 19:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.