If you still find yourself writing print(f"user_id: {user_id}") to debug your Python code, there's a much cleaner way. Since Python 3.8, you can add an equals sign = inside the curly braces of your f-string to print both the expression and its evaluated value.
Simply write print(f"{user_id=}") and Python will automatically output user_id='12345'. It works for expressions and function calls too, saving you a ton of keystrokes during quick debugging sessions.
Top comments (0)