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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python 示例_Python date isoweekday()方法与示例

發布時間:2023/12/1 python 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python 示例_Python date isoweekday()方法与示例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

python 示例

Python date.isoweekday()方法 (Python date.isoweekday() Method)

date.isoweekday() method is used to manipulate objects of date class of module datetime.

date.isoweekday()方法用于處理模塊日期時間的日期類的對象。

It uses a date class object and returns the day of the week as an integer, where Monday is 1 and Sunday is 7. It is the same as the date.weekday() function where we consider Monday is 0 incrementing by one for the coming days. It is an instance method as it works on an instance of the date class.

它使用日期類對象,并以整數形式返回星期幾,其中星期一是1,星期日是7。它與date.weekday()函數相同,在函數中我們認為星期一是0,以后將遞增1。天。 它是一個實例方法,因為它可用于date類的實例。

Module:

模塊:

import datetime

Class:

類:

from datetime import date

Syntax:

句法:

isoweekday()

Parameter(s):

參數:

  • None

    沒有

Return value:

返回值:

The return type of this method is a number which tells us what is the day of the week on that day.

此方法的返回類型是一個數字,該數字告訴我們當天的星期幾。

Example:

例:

## importing date class from datetime import date## Since we know the number, we can save them in a list and print the day on that number day =["0","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]## Creating an instance x = date.today() d = x.isoweekday() print("Today's isoweekday number is:", d) print("Today's day is:",day[d])x = date(2020, 1, 1) print("Day on", x.year,"new year was:", day[x.isoweekday()])x = date(2021, 1, 1) print("Day on", x.year,"new year will be:", day[x.isoweekday()])

Output

輸出量

Today's isoweekday number is: 3 Today's day is: Wednesday Day on 2020 new year was: Wednesday Day on 2021 new year will be: Friday

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

python 示例

總結

以上是生活随笔為你收集整理的python 示例_Python date isoweekday()方法与示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。