Python -tuple()- Funktion
Beispiel
Erstellen Sie ein Tupel mit Fruchtnamen:
x =
tuple(('apple', 'banana', 'cherry'))
Definition und Verwendung
Die tuple()
Funktion erstellt ein Tupelobjekt.
Hinweis: Sie können Elemente in einem Tupel nicht ändern oder entfernen.
Lesen Sie mehr über Mengen im Kapitel Python-Tupel .
Syntax
tuple(iterable)
Parameterwerte
Parameter | Description |
---|---|
iterable | Required. A sequence, collection or an iterator object |