变量的类型

type(被查看类型的数据)

# 方式1: 使用print直接输出类型信息
print(type("黑马程序员"))
print(type(666))
print(type(11.345))

<class 'str'>
<class 'int'>
<class 'float'>
string_type = type("黑马程序员")
int_type = type(666)
float_type = type(11.345)
print(string_type)
print(int_type)
print(float_type)

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

 

posted @ 2023-06-26 16:23  等风来lzd  阅读(31)  评论(0)    收藏  举报