0 votes
1 view
in Python by (47.8k points)

How can I call an external command (as if I'd typed it at the Unix shell or Windows command prompt) from within a Python script?

1 Answer

0 votes
by (107k points)
edited by

For calling an external command in Python you should look at the subprocess module in the standard library see the code below:-

import subprocess 

subprocess.run(["ls", "-l"])

To know more about this you can have a look at the following video tutorial:-

Related questions

+1 vote
2 answers
0 votes
2 answers
+9 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !