While following a tutorial for python, I got to know that we can use print for a variable name, and it works fine. But after assigning the print variable, how do we get back the original print function?
>>> print("Hello World!!")
Hello World!!!
>>> print = 5
>>> print("Hi")
Now, the last call gives the error TypeError: 'int' object is not callable, since now print has the integer value 5.
But, how do we get back the original functionality of print now? Should we use the class name for the print function or something?
As in, SomeClass.print("Hi")
?
Thanks in advance.
>>> print = 5
>>> print = __builtins__.print
>>> print("hello")
hello
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