资源简介
Python 3.7.3中文文档 双击 文档python-3.7.3-docs-html/index.html查看
代码片段和文件信息
from datetime import tzinfo timedelta datetime
ZERO = timedelta(0)
HOUR = timedelta(hours=1)
SECOND = timedelta(seconds=1)
# A class capturing the platform‘s idea of local time.
# (May result in wrong values on historical times in
# timezones where UTC offset and/or the DST rules had
# changed in the past.)
import time as _time
STDOFFSET = timedelta(seconds = -_time.timezone)
if _time.daylight:
DSTOFFSET = timedelta(seconds = -_time.altzone)
else:
DSTOFFSET = STDOFFSET
DSTDIFF = DSTOFFSET - STDOFFSET
class LocalTimezone(tzinfo):
def fromutc(self dt):
assert dt.tzinfo is self
stamp = (dt - datetime(1970 1 1 tzinfo=self)) // SECOND
args = _time.localtime(stamp)[:6]
dst_diff = DSTDIFF // SECOND
# Detect fold
fold = (args == _time.localtime(stamp - dst_diff))
return datetime(*args microsecond=dt.microsecond
tzinfo=self fold=fold)
def utcoffset(self dt):
if self._isdst(dt):
return DSTOFFSET
else:
return STDOFFSET
def dst(self dt):
if self._isdst(dt):
return DSTDIFF
else:
return ZERO
def tzname(self dt):
return _time.tzname[self._isdst(dt)]
def _isdst(self dt):
tt = (dt.year dt.month dt.day
dt.hour dt.minute dt.second
dt.weekday() 0 0)
stamp = _time.mktime(tt)
tt = _time.localtime(stamp)
return tt.tm_isdst > 0
Local = LocalTimezone()
# A complete implementation of current DST rules for major US time zones.
def first_sunday_on_or_after(dt):
days_to_go = 6 - dt.weekday()
if days_to_go:
dt += timedelta(days_to_go)
return dt
# US DST Rules
#
# This is a simplified (i.e. wrong for a few cases) set of rules for US
# DST start and end times. For a complete and up-to-date set of DST rules
# and timezone definitions visit the Olson Database (or try pytz):
# http://www.twinsun.com/tz/tz-link.htm
# http://sourceforge.net/projects/pytz/ (might not be up-to-date)
#
# In the US since 2007 DST starts at 2am (standard time) on the second
# Sunday in March which is the first Sunday on or after Mar 8.
DSTSTART_2007 = datetime(1 3 8 2)
# and ends at 2am (DST time) on the first Sunday of Nov.
DSTEND_2007 = datetime(1 11 1 2)
# From 1987 to 2006 DST used to start at 2am (standard time) on the first
# Sunday in April and to end at 2am (DST time) on the last
# Sunday of October which is the first Sunday on or after Oct 25.
DSTSTART_1987_2006 = datetime(1 4 1 2)
DSTEND_1987_2006 = datetime(1 10 25 2)
# From 1967 to 1986 DST used to start at 2am (standard time) on the last
# Sunday in April (the one on or after April 24) and to end at 2am (DST time)
# on the last Sunday of October which is the first Sunday
# on or after Oct 25.
DSTSTART_1967_1986 = datetime(1 4 24 2)
DSTEND_1967_1986 = DSTEND_1987_2006
def us_dst_range(year):
# Find start
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-04-09 01:09 python-3.7.3-docs-html\
文件 55478 2019-04-09 01:09 python-3.7.3-docs-html\genindex-T.html
目录 0 2019-02-14 13:30 python-3.7.3-docs-html\_downloads\
目录 0 2019-02-14 13:30 python-3.7.3-docs-html\_downloads\a01ac1c40eb86ec0f9e3c8e80f9eca65\
文件 5860 2019-02-14 13:27 python-3.7.3-docs-html\_downloads\a01ac1c40eb86ec0f9e3c8e80f9eca65\tzinfo_examples.py
文件 10648 2019-04-09 01:09 python-3.7.3-docs-html\genindex-Q.html
文件 107837 2019-04-09 01:09 python-3.7.3-docs-html\ob
目录 0 2019-02-14 13:29 python-3.7.3-docs-html\howto\
文件 146103 2019-04-09 01:01 python-3.7.3-docs-html\howto\regex.html
文件 300840 2019-04-09 01:01 python-3.7.3-docs-html\howto\logging-cookbook.html
文件 108541 2019-04-09 01:01 python-3.7.3-docs-html\howto\logging.html
文件 32483 2019-04-09 01:01 python-3.7.3-docs-html\howto\instrumentation.html
文件 59324 2019-04-09 01:01 python-3.7.3-docs-html\howto\curses.html
文件 76009 2019-04-09 01:01 python-3.7.3-docs-html\howto\unicode.html
文件 81527 2019-04-09 01:01 python-3.7.3-docs-html\howto\argparse.html
文件 9251 2019-04-09 01:01 python-3.7.3-docs-html\howto\index.html
文件 47213 2019-04-09 01:01 python-3.7.3-docs-html\howto\pyporting.html
文件 60129 2019-04-09 01:01 python-3.7.3-docs-html\howto\desc
文件 37660 2019-04-09 01:01 python-3.7.3-docs-html\howto\ipaddress.html
文件 154516 2019-04-09 01:01 python-3.7.3-docs-html\howto\functional.html
文件 40176 2019-04-09 01:01 python-3.7.3-docs-html\howto\sockets.html
文件 72427 2019-04-09 01:01 python-3.7.3-docs-html\howto\urllib2.html
文件 42143 2019-04-09 01:01 python-3.7.3-docs-html\howto\cporting.html
文件 47225 2019-04-09 01:01 python-3.7.3-docs-html\howto\sorting.html
文件 131757 2019-04-09 01:01 python-3.7.3-docs-html\howto\clinic.html
文件 577337 2019-04-09 01:00 python-3.7.3-docs-html\contents.html
目录 0 2019-02-14 13:29 python-3.7.3-docs-html\faq\
文件 59828 2019-04-09 01:01 python-3.7.3-docs-html\faq\extending.html
文件 208717 2019-04-09 01:01 python-3.7.3-docs-html\faq\programming.html
文件 29135 2019-04-09 01:01 python-3.7.3-docs-html\faq\windows.html
文件 8242 2019-04-09 01:01 python-3.7.3-docs-html\faq\index.html
............此处省略1033个文件信息
相关资源
- Python Data Analysis Cookbook by Ivan Idris
- wxPython学习手册
- python 实现KML转换为Excel的工具
- 微信公众号第三方平台python完整开发
- 语义分割代码(网盘)
- Python基础教程第三版PDF高清可复制.
- 《深度学习Deep Learning with Python 2017》
- 《机器学习》第2章中候选消除CANDID
- Python编程:从入门到实践高清完整版
- python太空大战游戏 源代码完整版
- Python微信打飞机小游戏
- python实现用户画像
- Test-Driven Development with Python
- Mastering Python Networking
- Learning Data Mining with Python - Second Edit
- Beginning Python: From Novice to Professional
- Python for Everybody: Exploring Data in Python
- Python Projects for Kids
- Qt5 Python GUI Programming Cookbook 无水印原
- 人脸识别算法 python
- Python3实现KNN的三个包含数据集,水果
- 廖雪峰python教程打印版完整版.pdf
- Python项目案例开发从入门到实战源代
- Twisted-17.9.0.tar.bz2和setuptools-19.6.tar.g
- XBEE Python Library
- OpenCV官方教程中文版Python版带完整书
- dlib18.17 编译好的python-dlib库 不需要
- Think Bayes
- python pip安装包
- Programming Computer Vision with Python.pdf
评论
共有 条评论