Executing External Commands with Python

Asked 2 years ago, Updated 2 years ago, 75 views

How do I run an external command that I write from a unix shell or window command prompt?

shell python command subprocess external

2022-09-22 12:37

1 Answers

os.system("some_command < input_file | another_command > output_file")

os.popen("echo Hello World").You can write read() subprocess.Popen("echo Hello World", shell=True, stdout=subprocess.PIPE).stdout.read() should be used together.


2022-09-22 12:37

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.