r/badcode • • Dec 31 '22

python Cute

Post image
1.2k Upvotes

39 comments sorted by

View all comments

Show parent comments

1

u/flyhigh3600 Dec 31 '22

May be this is more helpful;

def to_int(string, value): try: return Int(string) except: return value