发布时间:2022-11-10 09:45:16 人气:91 作者:多测师
有时候我们需要知道variable的数据类型,在python中有内置函数type可以获取variable的数据类型
1. 在console输入如下code:
id = 1
type(id)
输出:
《type 'int'>
2. 在console输入如下code:
id = 1L
type(id)
输出:
《type 'long'>
3. 在console输入如下code:
id = 1.0
type(id)
输出:
《type 'float'>
以上内容为大家介绍了python培训之如何查看变量的类型,希望对大家有所帮助,如果想要了解更多Python相关知识,请关注多测师。https://www.e70w.com/xwzx/