日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > python >内容正文

python

python日历模块_Python日历模块| setfirstweekday()方法与示例

發(fā)布時間:2025/3/11 python 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python日历模块_Python日历模块| setfirstweekday()方法与示例 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

python日歷模塊

Python calendar.setfirstweekday()方法 (Python calendar.setfirstweekday() Method)

setfirstweekday() method is an inbuilt method of the calendar module in Python. It works on simple text calendars and sets the first weekday from when the week should start. Here, Monday is 0, incrementing by 1 till Sunday, which is 6. We can also use calendar.day_name where calendar.MONDAY is 0 and calendar.SUNDAY is 6.

setfirstweekday()方法是Python中日歷模塊的內(nèi)置方法。 它適用于簡單的文本日歷,并設(shè)置從一周開始的第一個工作日。 在這里,星期一是0,遞增1直到星期日是6。我們還可以使用calendar.day_name ,其中calendar.MONDAY為0, calendar.SUNDAY為6。

Module:

模塊:

import calendar

Syntax:

句法:

setfirstweekday(weekday)

Parameter(s):

參數(shù):

  • weekday: It is an optional parameter, which represents the weekday number where MONDAY is 0 and SUNDAY is 6. Its default value is 0.

    weekday :這是一個可選參數(shù),代表周一的日期,其中MONDAY為0,SUNDAY為6。默認值為0。

Return value:

返回值:

The return type of this method is <class 'NoneType'>, it sets an iterator for the week day numbers.

此方法的返回類型為<class'NoneType'> ,它為工作日編號設(shè)置迭代器。

Example:

例:

# Python program to illustrate the # use of setfirstweekday() method# importing calendar module import calendar # using setfirstweekday() function val = calendar.setfirstweekday(2) # returns None print(val) # The function does not return anything, # it only sets the value print()val = calendar.setfirstweekday(calendar.WEDNESDAY) # sets the value to 2 which is the weekday value # for WEDNESDAY print(val) print()# Using firstweekday() method to check what was # the day sets calendar.setfirstweekday(calendar.SUNDAY) print(calendar.firstweekday()) # Prints 6 which is the weekday value for SUNDAY

Output

輸出量

NoneNone6

翻譯自: https://www.includehelp.com/python/calendar-setfirstweekday-method-with-example.aspx

python日歷模塊

總結(jié)

以上是生活随笔為你收集整理的python日历模块_Python日历模块| setfirstweekday()方法与示例的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。