My function convert.py is:
def convert(a,b)
factor = 2194.2
return (a-b)*factor
How do I run it from the command line with input arguments a
and b
?
I tried:
python convert.py 32 46
But got an error.
I did try to find the answer online, and I found related things but not the answer:
- Run function from the command line (Stack Overflow)
- How to read/process command line arguments? (Stack Overflow)
- http://www.cyberciti.biz/faq/python-command-line-arguments-argv-example/
- http://www.saltycrane.com/blog/2007/12/how-to-pass-command-line-arguments-to/
Also, where can I find the answer myself so that I can save this site for more non-trivial questions?