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

Calling Shell Commands from Python: OS.system vs Subprocess

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

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.

People Mentioned

Mention Thumbnail

Company Mentioned

Mention Thumbnail
featured image - Calling Shell Commands from Python: OS.system vs Subprocess
Marcos del Cueto HackerNoon profile picture
Marcos del Cueto

Marcos del Cueto

@marcosdelcueto

PhD in Theoretical Chemistry. Interested in Machine Learning applied to materials discovery

Learn More
LEARN MORE ABOUT @MARCOSDELCUETO'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Marcos del Cueto HackerNoon profile picture
Marcos del Cueto@marcosdelcueto
PhD in Theoretical Chemistry. Interested in Machine Learning applied to materials discovery

TOPICS

Languages

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