1

Unix システムなどの Windows コンソールで Python スクリプトを直接実行する方法はありますか?

#! /usr/bin/env python3.3
4

3 に答える 3

3

または、Python スクリプトとしても機能する .BAT ファイルを作成します。

@echo off
rem = '''
echo This is "%~f0" before Python

python -x "%~f0" %*

echo This is "%~f0" after Python

goto :end
'''

print "------------- Python code starts here --------------"
import sys
print sys.path
print sys.argv
print "------------- Python code ends here ----------------"

rem = '''
:end
rem '''
于 2013-08-30T13:36:05.360 に答える