【问题标题】:Correct type for sqlite connection?sqlite连接的正确类型?
【发布时间】:2017-06-19 06:36:48
【问题描述】:

对于 Python 类型还是很陌生,用什么类型来替换 ???在这里?

def update_sqlite(result: dict, db_connection: ???):
    pass

with sqlite3.connect('../data/Reports.db') as report_db:
    update_sqlite(result, report_db)

【问题讨论】:

    标签: python python-3.x types type-hinting


    【解决方案1】:

    啊,你说的是PEP 484?正确的类型是sqlite3.Connection

    【讨论】:

    • 似乎太容易了。 ;)
    • 例如对于光标,它将是 sqlite3.Cursor
    猜你喜欢
    • 1970-01-01
    • 2019-11-19
    • 2012-04-22
    • 1970-01-01
    • 2014-03-30
    • 1970-01-01
    • 2016-01-26
    • 1970-01-01
    • 2014-04-14
    相关资源
    最近更新 更多