import time
def date2mktime(date, format_='%Y-%m-%d'):
return int(time.mktime(time.strptime(date, format_)))
d=date2mktime('4000-01-01')
print(d)
C:\Users\Public\py36\python.exe D:/bizPythonDouban/selfPlatformAskAnswerProjeect/b.py
Traceback (most recent call last):
File "D:/bizPythonDouban/selfPlatformAskAnswerProjeect/b.py", line 4, in <module>
d=date2mktime('4000-01-01')
File "D:/bizPythonDouban/selfPlatformAskAnswerProjeect/b.py", line 3, in date2mktime
return int(time.mktime(time.strptime(date, format_)))
OverflowError: mktime argument out of range

  


C:\Users\sas\.PyCharm2017.2\system\python_stubs\-1603771140\time.py

def strptime(string, format): # real signature unknown; restored from __doc__
"""
strptime(string, format) -> struct_time Parse a string to a time tuple according to a format specification.
See the library reference manual for formatting codes (same as
strftime()). Commonly used format codes: %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. Other codes may be available on your platform. See documentation for
the C library strftime function.
"""
return struct_time C library function - strftime() http://www.tutorialspoint.com/c_standard_library/c_function_strftime.htm
#include <stdio.h>
#include <time.h> int main () {
time_t rawtime;
struct tm *info;
char buffer[80]; time( &rawtime ); info = localtime( &rawtime ); strftime(buffer,80,"%x - %I:%M%p", info);
printf("Formatted date & time : |%s|\n", buffer ); return(0);
}

  

												

python bug the C library strftime function.的更多相关文章

  1. Python datetime 格式化字符串:strftime()

    Python datetime 格式化字符串:strftime()   Python 的datetime模块 其实就是date和time 模块的结合, 常见的属性方法都比较常用 比如: datetim ...

  2. RobotFramework中加载自定义python包中的library(一个py文件中有多个类)

    结构如下: appsdk\ appsdk.py(这里面有多个类,包括appsdk,appsdksync等类) __init__.py ... ① 有个appsdk的文件夹(符合python包的定义) ...

  3. Python 学习笔记(三)Function

    python引用变量的顺序: 当前作用域局部变量->外层作用域变量->当前模块中的全局变量->python内置变量 1. Scope: • If a variable is assi ...

  4. robot framework用python扩展编写自定义library

    我的utils.py文件 #!/usr/bin/env python #-*- coding:utf8 -*- __version__ = '0.1' import sys reload(sys) s ...

  5. 关于Python的函数(Method)与方法(Function)

    先上结论: 函数(function)是Python中一个可调用对象(callable), 方法(method)是一种特殊的函数. 一个可调用对象是方法和函数,和这个对象无关,仅和这个对象是否与类或实例 ...

  6. Python的程序结构[4] -> 函数/Function[1] -> 内建函数

    内建函数 / Built-in Function or Method Python中有许多的内建函数(查看内建模块部分),此处将对内建函数进行介绍 内建函数 ord / built-in functi ...

  7. Python的程序结构[4] -> 函数/Function[2] -> 匿名函数

    匿名函数 / Anonymous Function 匿名函数是一种不需要绑定函数名的函数 (i.e. functions that are not bound to a name).匿名函数通过 la ...

  8. [python]bug和debug

    bug:代码中存在的语法或者逻辑问题 debug:自查和解决代码中的问题 (coding五分钟,debug两小时) 一.出现bug原因的四大类型 1.粗心 1)错误案例 上面这个错误就是因为 if语句 ...

  9. Python使用MySQLdb报Library not loaded: libmysqlclient.18.dylib错误

    Library not loaded: libmysqlclient.18.dylib就是找不到这个文件,首先要确定是否有这个文件 可以使用find命令,确认位置后可以使用如下两种方法:1.制作软连接 ...

随机推荐

  1. 7 天玩转 ASP.NET MVC — 第 2 天

    0. 前言 我相信在開始第 2 天的学习时,你已经顺利地完毕了第 1 天的课程. 我们回想一下第 1 天的主要关注点: 为什么选择 ASP.NET MVC ? ASP.NET Webforms 和 A ...

  2. haproxy+keepalived实现web集群高可用性[转]

    负载均衡集群的概念 负载均衡是设计分布式系统架构必须要考虑的因素之一,它指的是通过调度分发的方式尽可能将“请求”.“访问”的压力负载平均分摊到集群中的各个节点,避免有些节点负载太高导致访问延迟,而有些 ...

  3. PHP中替换换行符方法总结

    <?php header("content-type:text/html;charset=utf-8"); $str = "aaaa bbbb cccc dddd& ...

  4. RAC:Oracle11gR2:启动gsd服务

    /************/ 正在测试是否必须执行 gsdctl enable gsdctl start /************/ srvclt enable nodeapps -v srvctl ...

  5. NGUI之Toggle实现单选框

    一:使用步骤——创建一个checkboxes 1.首先在UI Root下建立一个Sprite,设置一张贴图,当作按钮的背景. 然后为其添加碰撞组件和Toggle组件 2.为第一个Sprite建立一个子 ...

  6. 【matlab】图像去噪的代码测试

    %% 自己设置频域的滤波窗口 girl=imread('F:\Users\*****\Pictures\CGS_stripe1.bmp'); girl=rgb2gray(girl); girl=im2 ...

  7. 使用matlab批量处理图像后在指定文件夹存储

    使用matlab批量处理图像后在指定文件夹存储 clear;clc;close all; Files=dir('D:\文件及下载相关\文档\MATLAB\postgraduate\Kodak\*.jp ...

  8. 记录下DynamicXml和HtmlDocument 使用方式

    之前解析都是XmlDocument.Load 而现在可以利用DynamicXml生成Dynamic对象实现强类型操作,很好用. /// <summary> /// 根据Xml路径动态解析成 ...

  9. 使用tensorflow深度学习识别验证码

    除了传统的PIL包处理图片,然后用pytessert+OCR识别意外,还可以使用tessorflow训练来识别验证码. 此篇代码大部分是转载的,只改了很少地方. 代码是运行在linux环境,tesso ...

  10. Codeforces Round #277.5 (Div. 2)部分题解

    A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...