易截截图软件、单文件、免安装、纯绿色、仅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的一些操作

# coding=gb2312
# 用中文注释前务必加上第一行
# 求模运算符,和C语言一样
print 10%9
# 整数相除仍然是整数
print 5/2
# 2后加上.就变成浮点数了
print 5/2.
# **表示求幂运算
print 7**4
# 函数用时要加上module.function
import math
print math.floor(19.8)
# 函数名也可以成为变量
func = math.floor
......

Python GTK+ 开发文档

1. Building an Application with PyGTK and Glade
2. Creating a GUI using PyGTK and Glade
3. A Beginner's Guide to Using pyGTK and Glade
4. Is there a walkthrough on getting PyGTK2 and libglade2 to work on win32 ......

python中import自己写的模块

只需要在文件中import与你写的文件的文件名一致的模块名即可,这时python会为你创建一个pyc文件的。
即,如果你已经写了一个名为ssss.py的文件,而现在你需要在名为aaaa.py的文件中使用ssss.py中定义的方法,那么你只需要在aaaa.py中加入import ssss,然后你就可以在aaaa.py中使用ssss.py中的方法(当然方法前需要加模块名 ......

用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操作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号