Python Return Value

HI I have been trying to return a value after execution of some logic from python script but its returning an empty value.

and code inside python script is same as the one you have given some time back.

import sys
def return_str(inpstr):
print(“print”+str(inpstr))
return str(inpstr)

if name == “main”:
return_str(int(sys.argv[1]))

Hi,

Have you mapped the input parameter correctly in input parameter window

Hi Amit,
Yes input parameter is maped correctly and I have checked it with print statement and it is getting logged in output Console without any issues. Issue is only with the output return. Kindly please help on this.

Hi,

Try storing return str(inpstr) in a variable and return that variable

Regards,
Amit

Hi

I have tried this way also but still its returning an empty value please find below code used for that

import sys
def return_str(inpstr):
tempres = str(inpstr);
return tempres

if name == “main”:
return_str(int(sys.argv[1]))

Hi,

Try this. This should work

import sys

def getString(n):
k = str(n)
print(k)
return k

if name == “main”:
getFirst(sys.argv[1])