python time模块中strptime用法

  

  time.strptime(string[, format])
  其中string参数即为要深入的日期字符串。format为格式化的日期字符串。
  

  

%Y Year with century as a decimal number.
%m Month as a decimal number [01,12].
%d Day of the month as a decimal number [01,31].
%H Hour (24-hour clock) as a decimal number [00,23].
%M Minute as a decimal number [00,59].
%S Second as a decimal number [00,61].
%z Time zone offset from UTC.
%a Locale's abbreviated weekday name.
%A Locale's full weekday name.
%b Locale's abbreviated month name.
%B Locale's full month name.
%c Locale's appropriate date and time representation.
%I Hour (12-hour clock) as a decimal number [01,12].
%p Locale's equivalent of either AM or PM

该方法返回一个元组,structtime.

| tm_gmtoff
| offset from UTC in seconds
|
| tm_hour
| hours, range [0, 23]
|
| tm_isdst
| 1 if summer time is in effect, 0 if not, and -1 if unknown
|
| tm_mday
| day of month, range [1, 31]
|
| tm_min
| minutes, range [0, 59]
|
| tm_mon
| month of year, range [1, 12]
|
| tm_sec
| seconds, range [0, 61])
|
| tm_wday
| day of week, range [0, 6], Monday is 0
|
| tm_yday
| day of year, range [1, 366]
|
| tm_year
| year, for example, 1993
|
| tm_zone
| abbreviation of timezone name

 

python time.striptime模块用法的更多相关文章

  1. python中argparse模块用法实例详解

    python中argparse模块用法实例详解 这篇文章主要介绍了python中argparse模块用法,以实例形式较为详细的分析了argparse模块解析命令行参数的使用技巧,需要的朋友可以参考下 ...

  2. python中MySQLdb模块用法实例

    篇文章主要介绍了python中MySQLdb模块用法,以实例形式详细讲述了MySQLdb模块针对MySQL数据库的各种常见操作方法,非常具有实用价值,需要的朋友可以参考下 本文实例讲述了python中 ...

  3. python中hashlib模块用法示例

    python中hashlib模块用法示例 我们以前介绍过一篇Python加密的文章:Python 加密的实例详解.今天我们看看python中hashlib模块用法示例,具体如下. hashlib ha ...

  4. [Python] datetime.timedelta模块用法

    python使用datetime模块timedelta实现日期时间相加: python计算明天的日期: from datetime import datetime from datetime impo ...

  5. python的xml模块用法

    xml是实现不同语言或程序之间进行数据交换的协议,跟json差不多,但json使用起来更简单,不过,古时候,在json还没诞生的黑暗年代,大家只能选择用xml呀,至今很多传统公司如金融行业的很多系统的 ...

  6. python 之os模块用法大全

    Python的标准库中的os模块包含普遍的操作系统功能.这个模块的作用主要是提供与平台无关的功能.也就是说os模块能够处理平台间的差异问题,使得编写好的程序无需做任何改动就能在另外的平台上运行 这边给 ...

  7. 小白进阶—python中os模块用法

    一.os模块概述 python中的os 模块包含普遍的操作系统功能,这个模块不受平台限制,即windows和linux上都适用. 二.常用方法 1.os.name 返回正在使用的平台.如果是windo ...

  8. python os.path模块用法详解

    abspath 返回一个目录的绝对路径 Return an absolute path. >>> os.path.abspath("/etc/sysconfig/selin ...

  9. python中optparse模块用法

    optparse模块主要用来为脚本传递命令参数,采用预先定义好的选项来解析命令行参数. 首先需要引入optparser模块,然后执行初始化,实例化一个OptionParser对象(可以带参,也可以不带 ...

随机推荐

  1. SQL 分组后,获取每组中的最大值对应的数据

    select gr,num,dt,(select bys from test where gr=b.gr and dt=b.dt) bys from ( select gr,count(0) num, ...

  2. cogs 80. 石子归并 动态规划

    80. 石子归并 ★★   输入文件:shizi.in   输出文件:shizi.out   简单对比时间限制:1 s   内存限制:128 MB 设有N堆沙(shi)子排成一排,其编号为1,2,3, ...

  3. 使用jQuery.extend创建一个简单的选项卡插件

    选项卡样式如图,请忽略丑陋的样式,样式可以随意更改 主要是基于jquery的extend扩展出的一个简单的选项卡插件,注意:这里封装的类使用的是es6中的class,所以不兼容ie8等低版本浏览器呦! ...

  4. Count the string[KMP]HDU3336

    题库链接http://acm.hdu.edu.cn/showproblem.php?pid=3336 这道题是KMP的next数组的一个简单使用,首先要理解next数组的现实意义:next[i]表示模 ...

  5. unity编辑器扩展_07(创建对话框,检测按钮的点击,点击按钮后提示信息,保存设置的数据,显示点击按钮后的处理的进度条信息)

    代码: using UnityEditor;using UnityEngine; public class ChangeValue : ScriptableWizard {               ...

  6. springboot2.X 使用spring-data组件对MongoDB做CURD

    springboot2.X 使用spring-data组件对MongoDB做CURD 使用背景 基于快速开发,需求不稳定的情况, 我决定使用MongoDB作为存储数据库,搭配使用spring-data ...

  7. 用Python操作文件

    用Python操作文件 用word操作一个文件的流程如下: 1.找到文件,双击打开. 2.读或修改. 3.保存&关闭. 用Python操作文件也差不多: f=open(filename) # ...

  8. 【HDU5409】CRB and Graph 边双联通 子树最值

    HDU # 题意 有一个简单图,n个点,m条边.对于每条割边,求出删去这条边后,在两个联通块中各取一个u,v.使得u<v,并且u尽量大而v尽量小. # 思路 求出边双联通是肯定的. 答案的限制条 ...

  9. CF1025C Plasticine zebra 思维 字符串

    Plasticine zebra time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  10. kick start 2019 round D T2题解

    题目大意:由N个房子围成一个环,G个人分别顺时针/逆时针在房子上走,一共走M分钟,每分钟结束,每个人顺/逆时针走到相邻的房子.对于每个房子都会记录最后时刻到达的人(可能是一群人).最终输出每个人会被几 ...