How to call an external command from Python

0 votes

Hi Guys,

I have created one python script. I want to use one Linux command inside this python script. How can I do this?

Jun 24, 2020 in Python by akhtar
• 38,170 points
101 views

1 answer to this question.

0 votes

Hi@akhtar,

You can use the os module in python. It helps you to run the Linux command in your python script. Use the below-given code in your script.

import os
os.system("ls -l")

I hope you will get some idea.

answered Jun 24, 2020 by MD
• 95,160 points

Related Questions In Python

0 votes
1 answer

How to call Python script from bash with an agrument?

Hi, You need to call the same command ...READ MORE

answered Jun 24, 2019 in Python by Shabnam
• 930 points
7,639 views
0 votes
1 answer

How to call an external command?

Hello @kartik, Look at the subprocess module in the standard ...READ MORE

answered Nov 18, 2020 in Python by Niroj
• 82,720 points
45 views
0 votes
1 answer

How to call an external command?

Look at the subprocess module in the standard library: import ...READ MORE

answered Nov 18, 2020 in Python by Gitika
• 65,870 points
69 views
0 votes
1 answer

I'm using Python 2.7 to convert an XML response (from a REST call to Atlassian Fisheye) into an HTML table.

You don't have a template matching tabularQueryResult in your ...READ MORE

answered Oct 4, 2018 in Python by Priyaj
• 58,120 points
258 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,033 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
1,556 views
0 votes
1 answer

How to call a function from another file in Python?

Hi@akhtar, You can use the import keyword to ...READ MORE

answered Jun 24, 2020 in Python by MD
• 95,160 points
1,775 views
0 votes
1 answer

How to crop face from a photo using cv2 in python?

Hi@akhtar, You can do this task using cv2 ...READ MORE

answered Apr 9, 2020 in Python by MD
• 95,160 points
166 views