i have a value which is float and string (it's in quotation marks) and i have to convert a integer value.
for example ,when i write x = "1.2"
, i want take this output:1
i wrote this code:
x = "1.2"
print(int(x))
but i get this error:
Traceback (most recent call last):
File xxx, line 2, in <module>
print(int(x))
ValueError: invalid literal for int() with base 10: '1.2'
how can i fix this ?