Running Linux commands within Python scripts

From , 3 Years ago, written in Python, viewed 226 times.
URL https://pastebin.vip/view/a267f936
  1. #/usr/bin/env python
  2. import subprocess
  3.  
  4. class RunCmd(object):
  5.     def cmd_run(self, cmd):
  6.         self.cmd = cmd
  7.         subprocess.call(self.cmd, shell=True)
  8.  
  9. #Sample usage
  10.  
  11. a = RunCmd()
  12. a.cmd_run('ls -l')
  13. #//python/5049

Reply to "Running Linux commands within Python scripts"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website