Python yineleme() İşlev
Örnek
Bir yineleyici nesne oluşturun ve öğeleri yazdırın:
x = iter(["apple", "banana", "cherry"])
print(next(x))
print(next(x))
print(next(x))
Tanım ve Kullanım
İşlev iter()
, bir yineleyici nesnesi döndürür.
Sözdizimi
iter(object, sentinel)
Parametre Değerleri
Parameter | Description |
---|---|
object | Required. An iterable object |
sentinel | Optional. If the object is a callable object the iteration will stop when the returned value is the same as the sentinel |
İlgili Sayfalar
reversed() işlevi, tersine çevrilmiş bir yineleyici nesnesi döndürür .