DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Bo
Bo

Posted on

Use _ to get the last evaluated value - Python Tips

In Python's interpreter, we can use _ to get the last evaluated value. This could be useful if you don't want to re-type the last evaluated value.

$ python3
Python 3.7.3 (default, Oct  7 2019, 12:56:13) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 1 + 2
3
>>> _
3
>>> 4 + _
7
>>>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

🌚 Turn on dark mode

πŸ”  Change your default font

πŸ“š Adjust your experience level to see more relevant content

Head to your account's Settings to do all this and more.