码迷,mamicode.com
首页 >  
搜索关键字:strftime    ( 605个结果
python发送smtp 邮件 图片
#-*- coding: utf-8 -*- # python2 import os import time import random import smtplib from time import strftime from email import encoders from email.he
分类:编程语言   时间:2016-02-23 00:52:03    阅读次数:218
python实现mysql备份的脚本
#!/usr/bin/env python # encoding: utf-8 import os,time,sys bakup_dir = '/home/bak/mysql' current_time = time.strftime('%Y%m%d%H%M%S') user = 'root' p....
分类:数据库   时间:2016-01-19 23:36:44    阅读次数:202
Python练习程序(三)函数练习--ATM模拟
功能要求:额度15000可以提现,手续费5%记录消费流水支持每月账单查询提供还款接口调用的相关模块:importtime#time模块,提供各种操作时间的函数 time.strftime("%Y-%m-%d%X",time.localtime()) ‘2015-12-1523:35:26‘importgetpass#getpass模块->命令行下输入密码的方法 pw..
分类:编程语言   时间:2015-12-22 06:40:54    阅读次数:410
python 之日期时间处理
##python时间操作一般使用time、datetime两个模块对于time模块,时间的表示模式有3种1、时间戳:time.time()2、字符串: time.strftime('%Y%m%d')3、struct_time格式: time.localtime()如下所示: 1 #时间操作 2 >>...
分类:编程语言   时间:2015-12-18 18:52:29    阅读次数:200
5.1.8 strftime()和strptime()的使用
strftime()函数是用来格式化一个日期、日期时间和时间的函数,支持date、datetime、time等类,把这些日期、日期时间或时间通过格式字符要求格式为字符串表示。相反strptime()函数就是从字符串表示的日期时间按格式化字符串要求转换为相应的日期时间。 对于time对象来说,格式化字符串不要使用年、月、日相关的字符,因为time对象没有相应的值。如果不幸使用了,只能默认输出为0值。...
分类:其他好文   时间:2015-12-07 12:36:18    阅读次数:292
Python xlsxwriter操作excel一例
#encoding:utf-8#!/usr/bin/python#author:zhangdonghong#email:zhangdonghongemail@163.com#date:2014-12-06importMySQLdbimportdatetime,timeimportxlsxwriterdefgetInfo():#now=datetime.datetime.now().strftime(‘%Y-%m-%d‘)Monday=datetime.datetime.fromtimestamp(time.t..
分类:编程语言   时间:2015-11-11 22:17:09    阅读次数:681
python时间相关
1、格式化时间time.strftime,返回字符串import timetime.strftime('%Y-%m-%d %H:%M:%S')2、时间差 timedeltafrom datetime import datetime,timedeltadate_time = datetime.now(...
分类:编程语言   时间:2015-11-06 16:13:51    阅读次数:184
python文件名与module名冲突,出错'module' object has no attribute 'strftime'
import timeprint time.strftime('%Y%m%d%H%M%S')以上小程序命名为time.py运行时出现错误提示:print time.strftime('%Y%m%d%H%M%S')AttributeError: 'module' object has no attri...
分类:编程语言   时间:2015-10-31 00:17:12    阅读次数:414
python 判断学期与学年
9,10,11,12,1 第一学期2,3,4,5,6,7 第二学期其中8月份放假,暂且放入第一学期。因为大部分学校都选在8月底开学import datetimedef getXNandXQ(): now=datetime.datetime.now() year=int(now.strftime("%...
分类:编程语言   时间:2015-10-19 22:22:23    阅读次数:186
Python时间戳和日期
import timelocaltime=time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time()))print localtime#结果是2015-10-13 15:59:13#将日期转化成时间戳:int_localtime=int...
分类:编程语言   时间:2015-10-13 17:12:25    阅读次数:145
605条   上一页 1 ... 49 50 51 52 53 ... 61 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!