In [1]:
print(int('100'))
print(type(int('100')))
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(',', '')))
In [5]:
print(float('1.23'))
print(type(float('1.23')))
In [6]:
print(float('.23'))
In [7]:
print(float('100'))
print(type(int('100')))
In [8]:
print(int('101', 2))
print(int('70', 8))
print(int('FF', 16))
In [9]:
print(int('0b101', 0))
print(int('0o70', 0))
print(int('0xFF', 0))
In [10]:
print(float('1.23e-4'))
print(type(float('1.23e-4')))
In [11]:
print(float('1.23e4'))
print(type(float('1.23e4')))
In [12]:
print(int('100'))
print(type(int('100')))
In [13]:
print(float('100'))
print(type(float('100')))
In [14]:
# print(float('ー1.23'))
# ValueError: could not convert string to float: '1.23'
In [15]:
print(float('-1.23'))
In [16]:
print(float('ー1.23'.replace('ー', '-').replace('.', '.')))