What do you want to save?
Add Code snippet
New code examples
-
Python 2022-02-15 09:30:14
how to use try except in while loop in python
while True: try: num = int(input("Enter an int: ")) except Exception as e: print(e) else: print("Thank you for the integer!") break# Enter an int: a# invalid literal for int() with base 10: 'a'# Enter an int: 3# Thank yo... Add solution -
Python 2021-11-06 19:19:16
python catch int conversion error
>>> for value in '12345', 67890, 3.14, 42, 0b010101, 0xFE, 'Not convertible': ... try: ... print('%s as an int is %d' % (str(value), int(value))) ... except ValueError as ex: ... print('"%s" cannot be converted t... Add solution -
Python 2021-10-11 12:34:05
Traceback (most recent call last): File "exploit.py", line 63, in <module> choice = menu() File "exploit.py", line 60, in menu return int(choice) ValueError: invalid literal for int() with base 10: ''
Traceback (most recent call last): File "exploit.py", line 63, in <module> choice = menu() File "exploit.py", line 60, in menu return int(choice) ValueError: invalid literal for int() with base 10: '' Add solution -
Python 2021-10-08 21:31:07
ValueError: invalid literal for int() with base 10: site:stackoverflow.com
# Just for the record: int('55063.000000') Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 10: '55063.000000' # use this int(float('55063.000000')) Add solution