X Tutup
Skip to content

Latest commit

 

History

History
56 lines (47 loc) · 1.85 KB

File metadata and controls

56 lines (47 loc) · 1.85 KB
title Python type()-Funktion – Python Spickzettel
description Gibt bei einem Argument den Typ eines Objekts zurück. Der Rückgabewert ist ein Typobjekt und im Allgemeinen dasselbe Objekt wie von object.__class__.
Python eingebaute Funktion type() Aus der Python 3 Dokumentation Mit einem Argument gibt den Typ eines Objekts zurück. Der Rückgabewert ist ein Typobjekt und im Allgemeinen dasselbe Objekt wie das, das von object.__class__ zurückgegeben wird.

Einführung

Die type() Funktion in Python ist eine eingebaute Funktion, die den Typ eines Objekts zurückgibt. Sie ist ein grundlegendes Werkzeug, um die Datentypen zu verstehen, mit denen Sie in Python arbeiten.

Beispiele

type('span')
type(99)
type(1.1)
type([1, 2])
type((1, 2))
type({1, 2})
type({'a': 1, 'b': 2})
<class 'str'>
<class 'int'>
<class 'float'>
<class 'list'>
<class 'tuple'>
<class 'set'>
<class 'dict'>

Relevante Links

  • Python Datentypen
  • isinstance()
  • issubclass()
  • str()
  • int()
  • float()
  • list()
  • tuple()
  • dict()
  • set()
X Tutup