Skip to content

Instantly share code, notes, and snippets.

@sonkm3
Created January 8, 2012 03:58
Show Gist options
  • Save sonkm3/1577137 to your computer and use it in GitHub Desktop.
Save sonkm3/1577137 to your computer and use it in GitHub Desktop.
python popenとかメモ
# 引数もリストで渡す
# 一行で
Popen(['ls','-l'],stdout=PIPE).stdout.read()
# 一行毎に
p = Popen(['ls','-l'],stdout=PIPE)
for line in p.stdout.read():
print line
# popen2は書いたまま
p=popen2.popen3('こまんど')
for line in p.fromchild:
print line
# この辺> http://www.python.jp/doc/release/library/subprocess.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment