次のような単純なデバッグ/ログ出力の代わりに:
print "error ", error_number
次のような必要に応じて拡張できるログ関数を使用したいと思います。
def log(condition, *message):
if(<do something here...>):
print(*message)
<perhaps do something more...>
次のように呼び出します。
log(condition, "error ", error_number)
しかし、次の構文エラーが発生します。
print *message
^ SyntaxError: invalid syntax
印刷機能の制限ですか、それとも機能させる方法はありますか? そうでない場合、私が使用できる print に相当するものはありますか?
ところで、私はPython 2.7を使用しています...