Source Code:
(back to article)
string = "abc" try: float_value = float(string) except ValueError: print("Could not parse string to float.") try: int_value = int(string) except ValueError: print("Could not parse string to int.")
Result:
Report an issue