What do you want to save?
Add Code snippet
New code examples
-
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