带有示例的Python date weekday()方法
Python date.weekday()方法 (Python date.weekday() Method)
date.weekday() method is used to manipulate objects of date class of module datetime.
date.weekday()方法用于操作模块日期时间的日期类的对象。
It uses a date class object and returns the day of the week as an integer, where Monday is 0 and Sunday is 6. It is an instance method.
它使用日期类对象,并以整数形式返回星期几,其中Monday是0,Sunday是6。它是一个实例方法。
Module:
模块:
import datetime
Class:
类:
from datetime import date
Syntax:
句法:
weekday()
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
## Creating an instance
x = date.today()
d = x.weekday()
print("Today's weekday number is:", d)
x = date(2020, 10, 30)
d1 = x.weekday()
print("Weekday number on the date",x,"will be:",d1)
print()
## Since we know the number,
## we can save them in a list and
## print the day on that number
day =["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
print("Today's day is:",day[d])
print("Day on date", x," will be:", day[d1])
Output
输出量
Today's weekday number is: 2
Weekday number on the date 2020-10-30 will be: 4
Today's day is: Wednesday
Day on date 2020-10-30 will be: Friday
翻译自: https://www.includehelp.com/python/date-weekday-method-with-example.aspx
带有示例的Python date weekday()方法相关推荐
- python 示例_带有示例的Python date timetuple()方法
python 示例 Python date.timetuple()方法 (Python date.timetuple() Method) date.timetuple() method is used ...
- python 示例_带有示例的Python date isocalendar()方法
python 示例 Python date.isocalendar()方法 (Python date.isocalendar() Method) date.isocalendar() method i ...
- 带有示例的Python date strftime()方法
Python date.strftime()方法 (Python date.strftime() Method) date.strftime() method is used to manipulat ...
- 带有示例的Python datetime weekday()方法
Python datetime.weekday()方法 (Python datetime.weekday() Method) datetime.weekday() method is used to ...
- lock_sh 示例_带有示例的Python date __str __()方法
lock_sh 示例 Python date .__ str __()方法 (Python date.__str__() Method) date.__str__() method is used t ...
- python wait之后怎么起起来_python wait方法_Python条件类| 带有示例的wait()方法
python wait方法 Python Condition.wait()方法 (Python Condition.wait() Method) wait() is an inbuilt method ...
- flush python_带有示例的Python File flush()方法
flush python 文件flush()方法 (File flush() Method) flush() method is an inbuilt method in Python, it is ...
- python wait方法_Python条件类| 带有示例的wait()方法
python wait方法 Python Condition.wait()方法 (Python Condition.wait() Method) wait() is an inbuilt method ...
- python线程任务run_Python线程类| 带有示例的run()方法
python线程任务run Python Thread.run()方法 (Python Thread.run() Method) Thread.run() method is an inbuilt m ...
最新文章
- Nature:科学家成功绘制出大脑神经细胞“地图”
- 鑿婂瓙鏇版祴璇曡崏绋縶29C28FD771BA4B0D8693}
- Java Review - 并发组件ConcurrentHashMap使用时的注意事项及源码分析
- 信息系统项目管理师全国通用吗
- IntelliJ IDEA2017 修改缓存文件的路径(转载:https://www.cnblogs.com/acm-bingzi/p/ideaCachePath.html)
- Python中get()函数用法【详解】——Python系列学习笔记
- opencv实现几幅图像拼接成一整幅大图
- Roman and Browser-罗曼的浏览器 CodeForce1100A 暴力
- Listview的OnScrollListener的滑动监听实现分页加载
- Python批量爬取名字中带有中文的pdf文件
- 离线语音识别技术品鉴——功能不同各有千秋
- Java框架_SpringBoot整合Spring Data JPA 转载:https://blog.csdn.net/lxp18850413505/article/details/80987550
- xeon e5-2400 系列处理器能做四路服务器吗?,至强处理器E5-2400系列双路云服务器推出...
- 【音视频】V4L2摄像头应用编程
- android连连看源代码,#经典连连看#源码分享
- Ubuntu安装以及简单设置
- java jsoup 网络爬虫 学习例子(八)京东和淘宝商品比价 PhantomJS
- python计算整数各位数字之和_编写函数,计算一个整数各位数字之和
- hbuilderx云打包ios证书的生成方法
- 为什么众多IT名人都在悼念金庸?
热门文章
- html输入表单jsp返回数据中文乱码,JSP/Servlet页面中文显示为乱码的解决方式
- FeedBack使用手册
- D类放大器背后的奥秘
- 正则表达式(匹配第一个花括号)
- Android 移动安全知识技术全解(加固技术、常规漏洞、Android 逆向......),移动安全问题不容忽视
- “Metro”,移动设备视觉语言的新新人类
- fstest下载安装测试
- PHP错题本功能实现,错题作用:错题本让错误变的有价值
- UE判断有没有打了勾的材质通道没有给上贴图的
- Codeforces Round #702 (Div. 3)ABCEF