언어&플랫폼/python 2014. 3. 21. 13:45

#!/usr/bin/python


import subprocess


#mount | grep devpts


p1 = subprocess.Popen(["mount"], stdout=subprocess.PIPE)

p2 = subprocess.Popen(["grep", "devpts"], stdin=p1.stdout, stdout=subprocess.PIPE)

out, err = p2.communicate()


print out

print 'err:'+str(err)

           



[결과]

devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)


err:None




'언어&플랫폼 > python' 카테고리의 다른 글

[python] 리스트 랜덤 선택  (0) 2015.01.20
[python] time 관련  (0) 2015.01.06
[python] dictionary 에 dictionary 붙이기  (0) 2013.12.18
[python] 띄어쓰기 제거  (0) 2013.12.10
[python] json decode  (0) 2013.12.10
posted by cozyboy
: