Skip to content

Commit 0c8e943

Browse files
committed
Basic Python
1 parent 4a9d038 commit 0c8e943

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

subprocess.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import sys
2+
import subprocess
3+
4+
def listdir(dir):
5+
cmd = 'dir' + dir
6+
print("Command to run:", cmd)
7+
(status, output) = subprocess.getstatusoutput(cmd)
8+
if status: ## Error case, print the command's output to stderr and exit
9+
sys.stderr.write(output)
10+
sys.exit(status)
11+
print(output)
12+
13+
listdir("path/of/your/folder")

0 commit comments

Comments
 (0)