gpt4 book ai didi

python - Python 中的无限时间增量

转载 作者:太空狗 更新时间:2023-10-30 03:00:48 25 4
gpt4 key购买 nike

如何在 Python 中表达无限时间增量?

到目前为止,我们使用 stdlib 中的 datetime,但如果它仅在第三方库中受支持,我们可以切换。

PostgreSQL 确实支持它。这对我来说很方便。我想用它来表示一个未完成的间隔。

我可以使用None,但是无限时间增量可以避免很多情况(if 语句)。

最佳答案

我找到了这个:http://initd.org/psycopg/docs/usage.html#infinite-dates-handling

PostgreSQL can store the representation of an “infinite” date, timestamp, or interval. Infinite dates are not available to Python, so these objects are mapped to date.max, datetime.max, interval.max. Unfortunately the mapping cannot be bidirectional so these dates will be stored back into the database with their values, such as 9999-12-31.

简答:不支持。

关于python - Python 中的无限时间增量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28042692/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com