In [2]:
a = 100
str_a = str(a)
str_a
Out[2]:
'100'
In [3]:
int_a = int(str_a)
int_a
Out[3]:
100
In [4]:
# int('32.5') #此代码会报错
In [5]:
float('324')
Out[5]:
324.0
In [6]:
float('34.2')
Out[6]:
34.2
In [7]:
int(float('55.6'))
Out[7]:
55
In [8]:
str(43.5)
Out[8]:
'43.5'
In [9]:
str(True)
Out[9]:
'True'
In [10]:
str('False')
Out[10]:
'False'
In [11]:
bool('True')
Out[11]:
True
In [12]:
bool('False')
Out[12]:
True
In [13]:
bool('')
Out[13]:
False
