Run Python file with arguments

5

In my program, I do the following operation:

import sys
qtd_ponts = int(sys.argv[1])

I would like to know a practical way to run this .py file by passing arguments without needing an IDE, for example .bat files.

    
asked by anonymous 24.06.2015 / 12:22

1 answer

7

To run a script as bat or directly from the console, just put the following command:

python arquivo.py [arg1 arg2 ...]

Remember that in the case of Windows, the folder where python is installed must be in the environment variable (path).

    
24.06.2015 / 12:40