Calling powershell command from Python
The subprocess module is a module in Python standard library.It consists of the call method which can be used to create new processes and receive there return values and error codes/
To run a powershell command you just pass the command name to the call method as a string.Here we are executing the netstat command:
Passing parameters from powershell to Python script
Execute following command in powershell.This will assign result of the powershell command to a powershell variable.The variable name here is $result.
You can call the above Python script from powershell as:
& python.exe Full path -p $result