python类day_name()的实例源码

CourseEvents.py 文件源码 项目:Pirka 作者: Mkohm 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def get_day(self):
        """
        :return: The name of the weekday the event occurs
        """
        try:
            day = self.data["dayNum"]
            return calendar.day_name[day - 1]
        except:
            pass
calendarbot.py 文件源码 项目:mr_meeseeks 作者: garr741 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def dateFormatter(self, date):
      month = calendar.month_name[date.month]
      weekday = calendar.day_name[date.weekday()]
      day = date.day
      year = date.year
      results = str(weekday) + ", " + str(month) + " " + str(day) + ", " + str(year)
      return results
dateable.py 文件源码 项目:covertutils 作者: operatorequals 项目源码 文件源码 阅读 14 收藏 0 点赞 0 评论 0
def __generateDays() :

    def day_data(i):
        dayname = calendar.day_name[i]
        return [i, str( i ), dayname, dayname.lower(), dayname[:3], dayname[:3].lower()]

    return {i: day_data(i) for i in range(7)}
_strptime.py 文件源码 项目:xxNet 作者: drzorm 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __calc_weekday(self):
        # Set self.a_weekday and self.f_weekday using the calendar
        # module.
        a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]
        f_weekday = [calendar.day_name[i].lower() for i in range(7)]
        self.a_weekday = a_weekday
        self.f_weekday = f_weekday
models.py 文件源码 项目:ksupcapp 作者: SkydiveK-State 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def __str__(self):
        return self.event.title + " - " + calendar.day_name[self.date.weekday()]
_strptime.py 文件源码 项目:pefile.pypy 作者: cloudtracer 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def __calc_weekday(self):
        # Set self.a_weekday and self.f_weekday using the calendar
        # module.
        a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]
        f_weekday = [calendar.day_name[i].lower() for i in range(7)]
        self.a_weekday = a_weekday
        self.f_weekday = f_weekday
_strptime.py 文件源码 项目:ouroboros 作者: pybee 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __calc_weekday(self):
        # Set self.a_weekday and self.f_weekday using the calendar
        # module.
        a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]
        f_weekday = [calendar.day_name[i].lower() for i in range(7)]
        self.a_weekday = a_weekday
        self.f_weekday = f_weekday
_strptime.py 文件源码 项目:ndk-python 作者: gittor 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __calc_weekday(self):
        # Set self.a_weekday and self.f_weekday using the calendar
        # module.
        a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]
        f_weekday = [calendar.day_name[i].lower() for i in range(7)]
        self.a_weekday = a_weekday
        self.f_weekday = f_weekday
_strptime.py 文件源码 项目:empyrion-python-api 作者: huhlig 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __calc_weekday(self):
        # Set self.a_weekday and self.f_weekday using the calendar
        # module.
        a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]
        f_weekday = [calendar.day_name[i].lower() for i in range(7)]
        self.a_weekday = a_weekday
        self.f_weekday = f_weekday
after_midnight.py 文件源码 项目:codewars 作者: AlekseiAQ 项目源码 文件源码 阅读 13 收藏 0 点赞 0 评论 0
def day_and_time(mins):
    date = datetime(2017, 4, 23, 0, 0) + timedelta(minutes=mins)
    return "{} {:02}:{:02}".format(day_name[date.weekday()], date.hour, date.minute)
_strptime.py 文件源码 项目:pmatic 作者: LarsMichelsen 项目源码 文件源码 阅读 38 收藏 0 点赞 0 评论 0
def __calc_weekday(self):
        # Set self.a_weekday and self.f_weekday using the calendar
        # module.
        a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]
        f_weekday = [calendar.day_name[i].lower() for i in range(7)]
        self.a_weekday = a_weekday
        self.f_weekday = f_weekday
_strptime.py 文件源码 项目:kbe_server 作者: xiaohaoppy 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def __calc_weekday(self):
        # Set self.a_weekday and self.f_weekday using the calendar
        # module.
        a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]
        f_weekday = [calendar.day_name[i].lower() for i in range(7)]
        self.a_weekday = a_weekday
        self.f_weekday = f_weekday
timestr.py 文件源码 项目:necrobot 作者: incnone 项目源码 文件源码 阅读 13 收藏 0 点赞 0 评论 0
def str_full_12h(dt):
    if not dt:
        return ''

    weekday = calendar.day_name[dt.weekday()]
    day = dt.strftime("%d").lstrip('0')
    hour = dt.strftime("%I").lstrip('0')
    pm_str = dt.strftime("%p").lower()
    datestr = dt.strftime("%b {0} @ {1}:%M{2} %Z".format(day, hour, pm_str))
    return weekday + ', ' + datestr
timestr.py 文件源码 项目:necrobot 作者: incnone 项目源码 文件源码 阅读 13 收藏 0 点赞 0 评论 0
def str_full_24h(dt):
    if not dt:
        return ''

    weekday = calendar.day_name[dt.weekday()]
    day = dt.strftime("%d").lstrip('0')
    hour = dt.strftime("%H").lstrip('0')
    if hour == '':
        hour = '00'
    datestr = dt.strftime("%b {0} @ {1}:%M %Z".format(day, hour))
    return weekday + ', ' + datestr
timestr.py 文件源码 项目:necrobot 作者: incnone 项目源码 文件源码 阅读 13 收藏 0 点赞 0 评论 0
def str_dateonly(dt):
    weekday = calendar.day_name[dt.weekday()]
    day = dt.strftime("%d").lstrip('0')
    return dt.strftime("{0}, %b {1}".format(weekday, day))
_strptime.py 文件源码 项目:Docker-XX-Net 作者: kuanghy 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __calc_weekday(self):
        # Set self.a_weekday and self.f_weekday using the calendar
        # module.
        a_weekday = [calendar.day_abbr[i].lower() for i in range(7)]
        f_weekday = [calendar.day_name[i].lower() for i in range(7)]
        self.a_weekday = a_weekday
        self.f_weekday = f_weekday
misc.py 文件源码 项目:slackbot 作者: cybernetisk 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def repo(message):
    from datetime import date
    import calendar
    my_date = date.today()
    day = calendar.day_name[my_date.weekday()]

    if(day == 'Tuesday'):
        message.reply('Ja')
    else:
        message.replay('Nei')
misc.py 文件源码 项目:slackbot 作者: cybernetisk 项目源码 文件源码 阅读 14 收藏 0 点赞 0 评论 0
def repo(message):
    from datetime import date
    import calendar
    my_date = date.today()
    day = calendar.day_name[my_date.weekday()]

    if(day == 'Tuesday'):
        message.reply('Ja')
    else:
        message.replay('Nei')
misc.py 文件源码 项目:slackbot 作者: cybernetisk 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def repo(message):
    from datetime import date
    import calendar
    my_date = date.today()
    day = calendar.day_name[my_date.weekday()]

    if(day == 'Monday'):
        message.reply('Ja')
    else:
        message.reply('Nei')
talk.py 文件源码 项目:takeout-inspector 作者: cdubz 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def talk_days(self):
        """Returns a stacked bar chart showing percentage of chats and emails on each day of the week.
        """
        c = self.conn.cursor()

        c.execute('''SELECT strftime('%w', `date`) AS dow,
            COUNT(CASE WHEN gmail_labels LIKE '%Chat%' THEN 1 ELSE NULL END) AS talk_messages,
            COUNT(CASE WHEN gmail_labels NOT LIKE '%Chat%' THEN 1 ELSE NULL END) AS email_messages
            FROM messages
            WHERE dow NOTNULL
            GROUP BY dow;''')

        talk_percentages = OrderedDict()
        talk_messages = OrderedDict()
        email_percentages = OrderedDict()
        email_messages = OrderedDict()
        for row in c.fetchall():
            dow = calendar.day_name[int(row[0]) - 1]  # sqlite strftime() uses 0 = SUNDAY.
            talk_percentages[dow] = str(round(float(row[1]) / sum([row[1], row[2]]) * 100, 2)) + '%'
            email_percentages[dow] = str(round(float(row[2]) / sum([row[1], row[2]]) * 100, 2)) + '%'
            talk_messages[dow] = row[1]
            email_messages[dow] = row[2]

        chats_trace = pgo.Bar(
            x=talk_messages.keys(),
            y=talk_messages.values(),
            text=talk_percentages.values(),
            name='Chat messages',
            marker=dict(
                color=self.config.get('color', 'primary'),
            ),
        )
        emails_trace = pgo.Bar(
            x=email_messages.keys(),
            y=email_messages.values(),
            text=email_percentages.values(),
            name='Email messages',
            marker=dict(
                color=self.config.get('color', 'secondary'),
            ),
        )

        layout = plotly_default_layout_options()
        layout['barmode'] = 'stack'
        layout['margin'] = pgo.Margin(**layout['margin'])
        layout['title'] = 'Chat (vs. Email) Days'
        layout['xaxis']['title'] = 'Day of the week'
        layout['yaxis']['title'] = 'Messages exchanged'

        return plotly_output(pgo.Figure(data=[chats_trace, emails_trace], layout=pgo.Layout(**layout)))


问题


面经


文章

微信
公众号

扫码关注公众号