from: https://stackoverflow.com/questions/2115615/assigning-value-to-shell-variable-using-a-function-return-value-from-python
def foo_fun(): return "some string" #return 10 .. alternatively, it can be an int if __name__ == "__main__" print foo_fun() # or sys.stdout.write("%s" % foo_fun())
shell
fooShell=$(python fooPy.py)echo $fooShell
输出:
“some string”