I have overriden the underscore variable _ in the Python interactive interpreter. How can I make the underscore work again without restarting the interpreter?
del _
A global _ shadows the builtin _, so deleting the global reveals the builtin again.
It's also worth noting that it doesn't actually stop working, it's just not accessible. You can import builtins to access it:
>>> _ = 'foobar'
>>> 22
22
>>> _
'foobar'
>>> import builtins
>>> 23
23
>>> builtins._
23
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With