Background I have been debugging my python scripts for ~2 years with plain from IPython import embed; embed(), and it has been working really fine. I just place the command on the line I want to examine, and when running the script I will have full IPython shell with capability for examining variables, defining functions, etc. On top of that, IPython shell comes with variable name tab completion.
この記事は Python Advent Calendar 2016 24日目の記事です。今回はPythonのデバッグのTipsをいくつか紹介します。 print()でデバッグ print()関数を使って確認したい値をstdoutに出力することでデバッグします。これで解決できるのであれば、それに越したことはありません。 FizzBuzzをデバッグします。今回は1から20までの数値を使ってFizzBuzzを出力したいとします。以下のコードには明らかなバグがあります。わかりますか? example_fizzbuzz_buggy.py:: for ii in range(1, 21): if ii % 3 == 0: print('Fizz') elif ii % 5 == 0: print('Buzz') elif ii % 15 == 0: print('FizzBuzz') else: pr
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く