個人的なメモ

めもめも.

pythonからシェルコマンド実行

import commands
cmd = “ls ./"
check = commands.getoutput(cmd) # 実行結果をcheckに返す
file_list = check.split() # カレントディレクトリのファイルをリストとしてfile_listへ格納.