How can I execute the below simple script called foo.py from the (bash) command line?
def hello():
return 'Hi :)'
I tried the following and got an error.
$ python -c 'import foo; print foo.hello()'
File "<string>", line 1
import foo; print foo.hello()
^
SyntaxError: invalid syntax
I'm able to execute the following but just receive no output.
$ python foo.py
$
python foo.pythis is correct. You didn't receive an output because you didn't call the function, you just defined it. def hello(): return 'Hi :)' print hello()$ python -c "import foo; print(foo.hello())>