Nguyễn Thiệu Vy
Member
How do I run a Python command in Linux?
Answer
To use it to run a Linux command, your code should look like below.
Answer
To use it to run a Linux command, your code should look like below.
- Sample Code using system() import os os.system(‘pwd’) os.system(‘cd ~’) os.system(‘ls -la’) …
- Writing a simple command using subprocess. …
- Writing a command with switches. …
- Storing the command output to a variable. …
- Saving the command output to a text file.