Skip to Content
Python 技術手冊 第三版
book

Python 技術手冊 第三版

by lex Martelli, Anna Martelli Ravenscroft, Steve Holden
January 2018
Intermediate to advanced content levelIntermediate to advanced
856 pages
17h 17m
Chinese
GoTop Information, Inc.
Content preview from Python 技術手冊 第三版
sched 模組
|
423
型別
rrule.rrule
的一個實體
r
提供數個方法:
after r.after(d, inc=False)
回傳最早的
datetime.datetime
實體,它是循環規則(recurrence rule
r
的一
次發生(occurrence),並且是在日期
d
之後發生的(當
inc
true,在日期
d
當日的發生,也是可接受的)。
before r.before(d, inc=False)
回傳最晚的
datetime.datetime
實體,它是循環規則(recurrence rule
r
的一
次發生(occurrence),並且是在日期
d
之前發生的(當
inc
true,在日期
d
當日的發生,也是可接受的)。
between r.between(start, finish, inc=False)
回傳所有的
datetime.datetime
實體,它們是循環規則
r
的發生,並且發生在
日期
start
finish
之間(當
inc
true,在日期
start
finish
當日的發
生也是可接受的)。
舉例來說,要說「2018 年整個一月每週一次(once a week throughout
January 2018)」,就用下列程式碼:
star t=datetim e.datetime(2018,1,1)
r=rrule.rrule(rrule.WEEKLY, dtstart=start)
for d in r.between(start,datetime.datetime(20
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

測試驅動開發|使用 Python

測試驅動開發|使用 Python

Harry J.W. Percival
Linux 内核观测技术BPF

Linux 内核观测技术BPF

David Calavera, Lorenzo Fontana

Publisher Resources

ISBN: 9789864766819