Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
と友達 ( 、 )sys.exc_info()よりも優先すべきですか?sys.last_valuesys.last_typesys.last_traceback
sys.exc_info()
sys.last_value
sys.last_type
sys.last_traceback
sys.last_valueと友達のドキュメントを見てください:
それらの使用目的は、対話型ユーザーがデバッガーモジュールをインポートし、エラーの原因となったコマンドを再実行することなく、事後デバッグを実行できるようにすることです。
したがって、デバッグを行うインタプリタを使用している場合はsys.last_value、を使用することをお勧めしますが、スクリプトでは、を使用することをお勧めしますsys.exc_info()。