rank vote view answer url
84 1085 1673710 15 url

如何查看 Python 变量的类型?


Python 不像 C/C++,不会出现你的问题

试一下:

>>> i = 123
>>> type(i)
<type 'int'>
>>> type(i) is int
True
>>> i = 123456789L
>>> type(i)
<type 'long'>
>>> type(i) is long
True
>>> i = 123.456
>>> type(i)
<type 'float'>
>>> type(i) is float
True

在 Python3.0中 int 和 long 已经不再进行区分了.

Copyright © taizilongxu 2018 all right reserved,powered by Gitbook该文件修订时间: 2018-10-17 17:33:54

results matching ""

    No results matching ""