2011年12月29日
摘要: s=" a b c "" ".join(s.split())awesome python! 阅读全文
posted @ 2011-12-29 17:55 eshizhan 阅读(2728) 评论(0) 推荐(0) 编辑
摘要: run a command as root using sudo from Python: 1 import subprocess 2 3 def mypass(): 4 mypass = '123' #or get the password from anywhere 5 return mypass 6 7 echo = subprocess.Popen(['echo',mypass()], 8 stdout=subprocess.PIPE, 9 )10 11 sudo = ... 阅读全文
posted @ 2011-12-29 09:59 eshizhan 阅读(3373) 评论(0) 推荐(1) 编辑