Python中的type(type)返回值

Given a statement type(type) – we have to print its return type value.

给定一个语句类型(类型) –我们必须打印其返回类型值。

Python type()函数 (Python type() function)

type() function is a library function in Python, it is used to get the type of the value/data type. It accepts an argument returns the class of the argument the object belongs to.

type()函数是Python中的一个库函数,用于获取值/数据类型的类型。 它接受参数返回对象所属参数的类。

Syntax:

句法:

    type(value/variable/type)

Return value of type(type):

类型(类型)的返回值:

type is also a class of type, the statement type(type)) returns "type".

type也是type的类,语句type(type))返回“ type”

Return value of type(type(int)):

类型的返回值(类型(整数)):

type(int) returns <class 'str'> and the statement type(<class 'str'>) returns "type".

type(int)返回<class'str'> ,语句type(<class'str'>)返回“ type”

Python code to demonstrate example of type() function

Python代码演示type()函数的示例

# python code to demonstrate example of 
# type() function

# printing types of various types of values
print(type('Hello'))
print(type(10))
print(type(10.23))

print(type(type))
print(type(type(int)))
print(type(type(str)))

print(type(type(10)))
print(type(type('Hello')))

Output

输出量

<class 'str'>
<class 'int'>
<class 'float'>
<class 'type'>
<class 'type'>
<class 'type'>
<class 'type'>
<class 'type'>


翻译自: https://www.includehelp.com/python/return-value-of-type-type-in-python.aspx

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值