pythonのコードを実行する
作者: 小見 拓
—
最終変更
2012年01月08日 12時13分
pythonのコードを実行する
ワンライナー。1行のコードを実行する。
" python のコードを「:python」コマンド後に記述する。 :python print "Hello Python" "# => Hello Python
ヒアドキュメント。複数の行に渡るコードを実行する。
" 終了の「EOF」の行には他に文字を入れないこと(「:」も駄目です)。
:python << EOF
i=0
while i < 10:
print "current no : " + str(i)
i += 1
EOF
"# => current no : 0
"# => current no : 1
"# => current no : 2
"# => current no : 3
"# => ....

前: ファイルに書かれたpythonのコードを実行する
