易截截图软件、单文件、免安装、纯绿色、仅160KB

python time模块详解

 python 的内嵌time模板翻译及说明
 
一、简介
  time模块提供各种操作时间的函数
  说明:一般有两种表示时间的方式:
       第一种是时间戳的方式(相对于1970.1.1 00:00:00以秒计算的偏移量),时间戳是惟一的
       第二种以数组的形式表示即(struct_time),共有九个元素,分别表示,同一个时间戳的struct_time会因为时区不同而不同
    year (four digits, e.g. 1998)
    month (1-12)
    day (1-31)
    hours (0-23)
    minutes (0-59)
    seconds (0-59)
    weekday (0-6, Monday is 0)
    Julian day (day in the year, 1-366)
    DST (Daylight Savings Time) flag (-1, 0 or 1) 是否是夏令时
    If the DST flag is 0, the time is given in the regular time zone;
    if it is 1, the time is given in the DST time zone;
    if it is -1, mktime() should guess based on the date and time.
    夏令时介绍:http://baike.baidu.com/view/100246.htm
    UTC介绍:http://wenda.tianya.cn/wenda/thread?tid=283921a9da7c5aef&clk=wttpcts
    
二、函数介绍
1.asctime()
  asctime([tuple]) -> string
  将一个struct_time(默认为当时时间),转换成字符串
        Convert a time tuple to a string, e.g. 'Sat Jun 06 16:26:11 1998'.
        When the time tuple is not present, current time as returned by localtime()
        is used.
        
2.clock()
  clock() -> floating point number
  该函数有两个功能,
  在第一次调用的时候,返回的是程序运行的实际时间;
  以第二次之后的调用,返回的是自第一次调用后,到这次调用的时间间隔
 
  示例:
  import time
if __name__ == '__main__':
time.sleep(1)
print "clock


相关文档:

Python模块随想随记

时常见到一些好的Python模块,如果不随时记下,等用的时候又是一阵乱翻,好在Python引用一个模块极其方便,OK,废话少说:
1. decimal
标准模块,2.4引入,用于浮点数的精确表示:
>>> 0.1 + 0.1 + 0.1 - 0.3
5.5511151231257827e-17
>>> from decimal import Decimal
>>> def _(x): retu ......

用Python写的图片蜘蛛人


    写了个图片蜘蛛人玩玩,抓了几个网页试试,感觉不不错。核心的代码可能20行也不到,简洁明了,嘻嘻。废话少说,翠花,上代码~~
#coding=utf-8
import os
import sys
import re
import urllib
URL_REG = re.compile(r'(http://[^/\\]+)', re.I)
IMG_REG = re.compile(r'<img[^>]*?src=([ ......

Python学习笔记 模块;文件与文本处理

1.Python中时间函数有几种不同的表示方法。一种是基于数字的表示方法,另外一种是用一系列值来表示,第三种是用ASCII码字符串的可读形式来表示的元组。 time()函数返回的是从某一时间点算起的秒数,该数值是一个浮点数。根据操作系统的不同,这个时间点也不同。通过求localtime(0)的值可以找到系统的该时间点。 localtime ......

python之学习类:python修改文件名


下面是对某文件夹下多个文件下指定文件换名字的实例(为了换名字,因为懒得手动改,折腾了一会搞出来的)
原理很简单,换文件名的话指定path就行 ,具体的自己看吧,仅供参考!
#-*- coding:utf-8 -*-
import os,sys
#=======================================
##对多个文件夹下的文件(夹)进行处理
#============ ......

python操作excel性能问题求助

http://bbs.chinaunix.net/thread-1586782-1-1.html
我刚刚用python写了一段操作excel的脚本,目的是把一个excel文件按照某一列中的字段拆分成多个文件,例如按照城市或者省份等,但是发现处理一个1700行的文件拆分成40多个文件时要运行30分钟左右,性能太慢,请高手帮忙看看怎么才能优化性能,谢谢。
新手写的脚本,请不 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号