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.
私はftp経由で私のウェブサイトに接続するプログラムを書いています。ログイン認証が失敗した場合、私はそれが何か他のことをし続けることを望みます。ただし、認証失敗エラーは自動的にプログラムを終了します。これを無視して続行する方法はありますか?
Python の例外処理を使用できます。
try: do_something() except Exception, ex: print "The process failed because", ex do_something_else()
do_something() を最初に試してみたいコードに置き換えます。
例外処理のリファレンス