【问题标题】:pprint results of psycopg2._psycopg.Diagnosticspsycopg2._psycopg.Diagnostics 的打印结果
【发布时间】:2013-08-16 20:04:37
【问题描述】:

我在调度程序中处理来自服务器的响应,其中包括 psycopg2 diag 对象。 pprint(PrettyPrint)'psycopg2._psycopg.Diagnostics' 对象对象以帮助我调试不正常的异常的最佳方法是什么?它的字符串表示反映了它的类型:<'psycopg2._psycopg.Diagnostics'>

【问题讨论】:

    标签: python postgresql-9.2 psycopg2


    【解决方案1】:
    out = {}
    for prop in dir(e.diag):
        if not re.match(r'__', prop):
            out[prop] = getattr(e.diag, prop)
    pprint.pprint(out)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-11
      • 1970-01-01
      • 1970-01-01
      • 2018-10-16
      • 2019-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多