Python @ DjangoSpin

Python: The "_" identifier in Interactive Sessions

Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon
Reading Time: 1 minutes

_ in Python

_ in Python

_ in Python: The _ identifier stores the most recently printed expression. This identifier can be used to quickly access the last computed result while working interactively. However, this identifier is only available in interactive sessions, and not in modules.

_ in Python

>>> a = 5
>>> _
5


>>> sum(range(10))
45
>>> _
45
>>> _ + _
90
Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon

Leave a Reply