![图片[1]-python如何查看变量的类型-uusu优素-乐高,模型,3d打印,编程](http://uusucn.zbbe.cn/wp-content/uploads/2024/01/5d6f632d8ebd8901.jpg)
有时候我们需要知道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'>原文来自:https://www.py.cn
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
    

















































暂无评论内容