当前位置: 首页>>代码示例>>Python>>正文


Python Delorean.weekday方法代码示例

本文整理汇总了Python中delorean.Delorean.weekday方法的典型用法代码示例。如果您正苦于以下问题:Python Delorean.weekday方法的具体用法?Python Delorean.weekday怎么用?Python Delorean.weekday使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在delorean.Delorean的用法示例。


在下文中一共展示了Delorean.weekday方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Delorean

# 需要导入模块: from delorean import Delorean [as 别名]
# 或者: from delorean.Delorean import weekday [as 别名]
#return d.datetime.strftime("%A, %b. %d, %Y at %I:%M %p")

day_names = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
             "Saturday", "Sunday"]

print "Today's scheduled work"
print "----------------------"
print "user\tstart_time\tend_time"

# Iterate each user
for luser in models.Luser.query.all():
   
    # We need to use the time in the user's own timezone, because
    # we are storing naive times in the user's schedule.
    now = Delorean(timezone=luser.profile[0].timezone).datetime
    day = now.weekday()

    mailer = Mailer(**MAILER_PARAMS)

    # Users have multiple schedules. Check all of them.
    for schedule in luser.schedules:

        # Check each day until we hit the day that is today, in the
        # user's timezone.
        for range in schedule.ranges:
            if range.day is not None and range.day.name == day_names[day]:

                # Print out today's users who have hours, as an aid.
                print "%s\t%s\t%s" % (luser.profile[0].username,
                                      range.start_time,
                                      range.end_time)
开发者ID:roeske,项目名称:codecolab,代码行数:33,代码来源:remind_user_to_report.py


注:本文中的delorean.Delorean.weekday方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。