import time
import datetime #今天星期几
today=int(time.strftime("%w"))
print today #某个日期星期几
anyday=datetime.datetime(2013,05,13).strftime("%w")
print anyday

https://blog.csdn.net/yangli91628/article/details/8921123

[py]python的time和datetime模块获取星期几的更多相关文章

  1. Python的time和datetime模块

    Python的time和datetime模块 time 常用的有time.time()和time.sleep()函数. import time print(time.time()) 149930555 ...

  2. python中time、datetime模块的使用

    目录 python中time.datetime模块的使用 1.前言 2.time模块 1.时间格式转换图 2.常用方法 3.datetime模块 python中time.datetime模块的使用 1 ...

  3. Python 入门之 内置模块 -- datetime模块

    Python 入门之 内置模块 -- datetime模块 1.datetime模块 from datetime import datetime (1)datetime.now() 获取当前时间和日期 ...

  4. python标准库:datetime模块

    原文地址:http://www.bugingcode.com/blog/python_datetime.html datatime 模块题共用一些处理日期,时间和时间间隔的函数.这个模块使用面向对象的 ...

  5. Python中time和datetime模块的简单用法

    python中与时间相关的一个模块是time模块,datetime模块可以看为是time模块的高级封装. time模块中经常用到的有一下几个方法: time()用来获取时间戳,表示的结果为从1970年 ...

  6. python基础--time和datetime模块

    一:说明在Python中,通常有这几种方式来表示时间:1)时间戳 2)格式化的时间字符串 3)元组(struct_time)共九个元素.由于Python的time模块实现主要调用C库,所以各个平台可能 ...

  7. Py修行路 内置模块补充 datetime模块

      Python提供了多个内置模块用于操作日期时间,像calendar,time,datetime.datetime模块用于是date和time模块的合集,他内部重新封装了time模块,相比于time ...

  8. [ Python入门教程 ] Python中日期时间datetime模块使用实例

    Python中datetime模块提供强大易用的日期处理功能,用于记录程序操作或修改时间.时间计算.日志时间显示等功能.datatime模块重新封装了time模块,提供的类包括date.time.da ...

  9. Python之 time 与 datetime模块

    time与datetime模块 一.time 在Python中,通常有这几种方式来表示时间: 时间戳(timestamp):通常来说,时间戳表示的是从1970年1月1日00:00:00开始按秒计算的偏 ...

随机推荐

  1. python 中 打印及格式化字符串的相关方法

    原文 将值转换为字符串 Python 有多种方式将任何值转为字符串: 将它传给 repr() 或 str() 函数. repr() 和 str() 的区别,看几个例子: >>> pr ...

  2. Asp.NET调用有道翻译API

    调用有道API进行翻译,如图: HTML: <%@ Page Language="C#" AutoEventWireup="true" CodeFile= ...

  3. 【每日一题】 UVA - 1589 Xiangqi 函数+模拟 wa了两天

    题意:背景就是象棋, 题解:坑点1(wa的第一天):将军可以吃掉相邻的棋子,(然行列也写反了orz) 坑点2(wa的第二天):将军到马要反过来写,边界有误,并且第一次碰到的车才算(写到后来都忘了) # ...

  4. yum下载rpm包

    方法一:downloadonly插件 1.安装插件 yum -y install yum-download  2.下载httpd软件包到当前文件夹内 yum -y install httpd -dow ...

  5. 转: jquery中ajax回调函数使用this

    原文地址:jquery中ajax回调函数使用this 写ajax请求的时候success中代码老是不能正常执行,找了半天原因.代码如下 $.ajax({type: 'GET', url: " ...

  6. LeetCode 868 Binary Gap 解题报告

    题目要求 Given a positive integer N, find and return the longest distance between two consecutive 1's in ...

  7. LeetCode 942 DI String Match 解题报告

    题目要求 Given a string S that only contains "I" (increase) or "D" (decrease), let N ...

  8. kali蓝牙连接

    http://blog.csdn.net/hailangnet/article/details/47723181 http://www.aiuxian.com/article/p-3012084.ht ...

  9. python3安装ipython 过程以及问题

    由于需要再python3的环境下运行demo,因此安装了python3的ipython notebook,过程如下: sudo pip3 install ipython[all]这样就安装了pytho ...

  10. 基于sendmail的简单zabbix邮件报警

    1.修改zabbix server hostname声明:在配置zabbix的Email报警之前,需要将sendmail使用的域名进行相应的修改,系统默认为localhost.localdomain, ...