If I have a command line like this:
abc -c config.json| xyz -c test.json
How can I run it in Python file? I mean we will don't type "abc -c config.json| xyz -c test.json" in the terminal.
xyz and abc are applications that I have written.
So, May I have a help?
2 Answers 2
You can use this
os.system("abc -c config.json| xyz -c test.json")
This is like running abc -c config.json| xyz -c test.json in command prompt.
Comments
Im a little confused by your question.
If you want to make a system call from within python you would use the subprocess module
x = subprocess.Popen("ls /home", shell=True, stdout=subprocess.PIPE).stdout.read()
If you want to run a python command from the command line you can either write it to a file and execute
python myFile.py
Or, run the commands directly to python
python -c "print("testing")"