I am attempting to handle errors within an f-string, but my attempts don't seem to work. Is there a way to accomplish this?
string = f"For example I thought this syntax would work but it doesn't {try: 5/0 except Exception: str(infinity)}"
You can't. Move the exception handling out of the f-string.