paint-brush
Calling Shell Commands from Python: OS.system vs Subprocessby@marcosdelcueto
33,973 reads
33,973 reads

Calling Shell Commands from Python: OS.system vs Subprocess

by Marcos del CuetoNovember 17th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Calling Shell Commands from Python is useful to be familiar with how to call these commands efficiently from your Python code. In this short article, I discuss how to use the older (although still relatively common) os.system command and the newer subprocess command. I will show some of their potential risks, limitations and provide complete examples of their use. For example, the code below would be equivalent to the previouse code below. The article also provides examples of the use of these commands.
featured image - Calling Shell Commands from Python: OS.system vs Subprocess
Marcos del Cueto HackerNoon profile picture
Marcos del Cueto

Marcos del Cueto

@marcosdelcueto

L O A D I N G
. . . comments & more!

About Author

Marcos del Cueto HackerNoon profile picture
Marcos del Cueto@marcosdelcueto

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite