タグ

pythonに関するgusukuのブックマーク (2)

  • Python CGIのデバッグ

    CGIプログラムは通常はWebサーバから呼び出されて実行されるので、高機能なデバッガが利用できないため、とてもデバッグがしにくいです。 しかし、Pythonの標準ライブラリには、CGIのデバッグに役立つ2つのモジュールが用意されていて、デバッグがかなり楽にできます。 まず最初に紹介するのが、cgitbです。このモジュールを使うと、CGIプログラムで捕捉されない例外が発生したときに、トレースバック情報をHTMLで出力してくれます。使い方は非常に簡単で、 import cgitb; cgitb.enable() と最初の方に書いておくだけです。後は例外が発生したときに、勝手になんとかしてくれます。 実際にcgitbの出力がどんな感じになるのか、サンプルを用意しました。 http://niisaka.s33.xrea.com/cgi-bin/test/python-cgi.cgi このCGIは1

    Python CGIのデバッグ
  • xml.dom — The Document Object Model API

    xml.dom — The Document Object Model API¶ Source code: Lib/xml/dom/__init__.py The Document Object Model, or “DOM,” is a cross-language API from the World Wide Web Consortium (W3C) for accessing and modifying XML documents. A DOM implementation presents an XML document as a tree structure, or allows client code to build such a structure from scratch. It then gives access to the structure through a

    xml.dom — The Document Object Model API
  • 1