How to understand '_' in these tests?

fl rxjwg98 at gmail.com
Tue Jun 2 00:18:02 EDT 2015


Hi,

I just know that '_' is the last result in the Python interpreter. I feel that
it is like 'ans' in Matlab. When I run the following commands. The result of
'_' are always '4'.


Because I have tried several commands, such as reversed('fred'), xx and rx,
 '4' are always there.

What is your explanation about the following?


Thanks,






>>> reversed('fred')
<reversed object at 0x02A8DD50>
>>> _
'4'
>>> _
'4'
>>> xx
33223
>>> _
'4'
>>> rx=reversed('fred')
>>> _
'4'
>>> xx
33223
>>> _
'4'
>>> 



More information about the Python-list mailing list