In [1]:
print(int('100'))
print(type(int('100')))


100
<class 'int'>

In [2]:
# print(int('1.23'))
# ValueError: invalid literal for int() with base 10: '1.23'

In [3]:
# print(int('10,000'))
# ValueError: invalid literal for int() with base 10: '10,000'

In [4]:
print(int('10,000'.replace(',', '')))


10000

In [5]:
print(float('1.23'))
print(type(float('1.23')))


1.23
<class 'float'>

In [6]:
print(float('.23'))


0.23

In [7]:
print(float('100'))
print(type(int('100')))


100.0
<class 'int'>

In [8]:
print(int('101', 2))
print(int('70', 8))
print(int('FF', 16))


5
56
255

In [9]:
print(int('0b101', 0))
print(int('0o70', 0))
print(int('0xFF', 0))


5
56
255

In [10]:
print(float('1.23e-4'))
print(type(float('1.23e-4')))


0.000123
<class 'float'>

In [11]:
print(float('1.23e4'))
print(type(float('1.23e4')))


12300.0
<class 'float'>

In [12]:
print(int('100'))
print(type(int('100')))


100
<class 'int'>

In [13]:
print(float('100'))
print(type(float('100')))


100.0
<class 'float'>

In [14]:
# print(float('ー1.23'))
# ValueError: could not convert string to float: '1.23'

In [15]:
print(float('-1.23'))


-1.23

In [16]:
print(float('ー1.23'.replace('ー', '-').replace('.', '.')))


-1.23