Python subprocess lets you to create new processes and obtain their outputs.
In this video, I have given a basic demo on how we can use subprocess module of Python to call linux commands. You can also use the same run() function of subprocess to execute commands in Windows also(with different commands obviously).
Index:
00:00 Intro
01:11 Subprocess modules run() function
01:44 Run 'pwd'
02:01 Run 'ls'
02:31 Passing commands using array
04:26 Capture output in CompletedProcess object
05:52 Capture stdout
06:48 Getting output as string
07:22 Handle errors
09:22 Writing process output to files
12:38 Executing a shell script
13:38 Executing an interactive shell script
Follow us on :
Facebook : / raksrahul-100219708647780
Instagram : / raksrahul_ig
#Python #Linux #Shell #Eclipse #subprocess #raksrahul