我正在尝试将重复规则打印为iCalendar格式指定的字符串(请参阅RFC 5545)。我使用python dateutils,特别是dateutil.rrule来创建重复规则,我想将其打印为如下字符串:
"RRULE:FREQ=DAILY;COUNT=5"
有人能告诉我是否有方法可以实现这个目标吗?
我想我正在使用labix dateutils btw。
非常感谢!
答案 0 :(得分:7)
python-dateutil
包中没有方法或功能来执行此操作。有关可能有用的修补程序,请参阅此错误:https://bugs.launchpad.net/dateutil/+bug/943512。
答案 1 :(得分:1)
虽然这是在提出问题四年后编写的,但dateutil
现在有一个__str__
方法(请参阅source code),该方法允许print
一个In [1]: from dateutil.rrule import *
In [2]: my_rrule = rrule(DAILY, count=5)
In [3]: print(my_rrule)
DTSTART:20161202T184513
FREQ=DAILY;COUNT=5
这样一种形式:
<VirtualHost *:443>
ServerName authtest.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order allow,deny
Allow from All
</Proxy>
<LocationMatch "/google">
ProxyPass https://www.google.com/
ProxyPassReverse https://www.google.com/
</LocationMatch>
</VirtualHost>
答案 2 :(得分:0)
这是John Doe
Jane Doe
<br />
<b>Warning</b>: printer_open(): couldn't connect to the printer [Resource id #5] in <b>F:\LOKAL\text\text.php</b> on line <b>15</b><br />
?>
的子类,其中包含两个建议的rrule
补丁,可以输出python-dateutil
。请注意,可能有充分的理由没有接受补丁,我只测试了最简单的情况。不处理折线。
请参阅错误跟踪器进行讨论:
https://bugs.launchpad.net/dateutil/+bug/943512
https://bugs.launchpad.net/dateutil/+bug/943509
rrule