45 lines
490 B
Python
45 lines
490 B
Python
|
"""
|
||
|
类型转换
|
||
|
|
||
|
Version: 0.1
|
||
|
Author: 骆昊
|
||
|
Date: 2018-02-27
|
||
|
"""
|
||
|
|
||
|
a = 100
|
||
|
b = str(a)
|
||
|
c = 12.345
|
||
|
d = str(c)
|
||
|
e = '123'
|
||
|
f = int(e)
|
||
|
g = '123.456'
|
||
|
h = float(g)
|
||
|
i = False
|
||
|
j = str(i)
|
||
|
k = 'hello'
|
||
|
m = bool(k)
|
||
|
print(a)
|
||
|
print(type(a))
|
||
|
print(b)
|
||
|
print(type(b))
|
||
|
print(c)
|
||
|
print(type(c))
|
||
|
print(d)
|
||
|
print(type(d))
|
||
|
print(e)
|
||
|
print(type(e))
|
||
|
print(f)
|
||
|
print(type(f))
|
||
|
print(g)
|
||
|
print(type(g))
|
||
|
print(h)
|
||
|
print(type(h))
|
||
|
print(i)
|
||
|
print(type(i))
|
||
|
print(j)
|
||
|
print(type(j))
|
||
|
print(k)
|
||
|
print(type(k))
|
||
|
print(m)
|
||
|
print(type(m))
|