一个Python模块Pendulum的问题

简介: 一个Python模块Pendulum的问题

最近在某微信公众号上看到一篇关于Python工具的文章,其中有一个Pendulum管理时间的工具。我照着练习了一下,练习代码如下:

from datetime import datetime

import pendulum

sh = pendulum.timezone('Asia/Shanghai')

shc = pendulum.now()

print('亚洲上海时区当前时间: ', shc)


ny = pendulum.timezone('America/New_York')

nyc = pendulum.now()

print('美国纽约时区当前时间:', nyc)

nyc.add(years = 1)

执行结果如下图:

image.png

在windows环境,centos7环境执行结果都一样。发现的问题是:我虽然更改了时区,但是时间显示都一样。不知问题出在哪里?期望得到解答。

相关文章
|
3天前
|
JSON API 数据格式
30天拿下Python之requests模块
30天拿下Python之requests模块
16 7
|
2天前
|
人工智能 数据可视化 搜索推荐
Python异常模块与包
Python异常模块与包
|
3天前
|
开发者 Python
30天拿下Python之模块和包
30天拿下Python之模块和包
|
4天前
|
Python
Python中正则表达式(re模块)用法详解
Python中正则表达式(re模块)用法详解
13 2
|
3天前
|
API Python
30天拿下Python之matplotlib模块
30天拿下Python之matplotlib模块
|
3天前
|
SQL 数据处理 数据库
30天拿下Python之pandas模块
30天拿下Python之pandas模块
|
3天前
|
存储 索引 Python
30天拿下Python之numpy模块
30天拿下Python之numpy模块
|
3天前
|
开发者 Python
30天拿下Python之logging模块
30天拿下Python之logging模块
|
3天前
|
安全 索引 Python
30天拿下Python之collections模块
30天拿下Python之collections模块
|
3天前
|
SQL 数据库连接 数据库
30天拿下Python之sqlite3模块
30天拿下Python之sqlite3模块