Disable Python return statement from printing object it returns -
I want to disable "return" from printing anything that comes back to the python shell.
For example, a sample Python script looks like this:
def func1 (): list = [1,2,3,4,5] Print list return list
Now, if I do the following:
dragon-i test.py & gt; & Gt; Func1 ()
It will always give me two print on the dragon shell I just want to print and get the returned item.
The reason for the print is not the return statement, but the shell shell itself prints an object which is called the command line But there is the result of an operation.
The reason for this is:
& gt; & Gt; & Gt; A = 'Hello' & gt; & Gt; & Gt; A 'Halo'
has a value as a result in the final statement (because it has not been assigned to anything else). So it is printed by the shell.
The problem is not a "return", but the shell itself is itself. But this is not a problem, because the working code is not normally implemented in the interactive shell (thus, nothing is printed). Thus, no problem.
Comments
Post a Comment