نوع Python () وظيفة
مثال
أعد نوع هذه الكائنات:
a = ('apple', 'banana', 'cherry')
b = "Hello World"
c = 33
x =
type(a)
y = type(b)
z = type(c)
التعريف والاستخدام
تقوم type()
الدالة بإرجاع نوع الكائن المحدد
بناء الجملة
type(object,
bases, dict)
قيمه المعامل
Parameter | Description |
---|---|
object | Required. If only one parameter is specified, the type() function returns the type of this object |
bases | Optional. Specifies the base classes |
dict | Optional. Specifies the namespace with the definition for the class |