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

python操作excel


既然选择了远方,就必须日夜兼程 http://wrsuifeng.javaeye.com
Python代码
# Filename: excel.py   
import os,sys,time   
import win32com.client   
import traceback   
  
excel = win32com.client.Dispatch("Excel.Application")   
filename = "D:\\test.xls"  
  
try:   
    d1 = excel.Workbooks.Add()   
    sheet = d1.Sheets(1)   
       
    for i in xrange(1,10):   
        for j in xrange(1,10):   
            sheet.Cells(i,j).Value = str(i*j)   
    d1.SaveAs(filename)   
except Exception, e:   
    print traceback.print_exc()   
    print e   
       
excel.Quit()  


相关文档:

python,c++,C#随机数生成

先说python
python的random模块提供了多个伪随机数发生器,默认都是用当前时间戳为随机数种子。
下面是该模块几个最常用的函数
random() Return the next random floating point number in the range [0.0, 1.0). 
randint(a,b) Return a random integer N such that a <=
N <= b
randrange([star ......

python算法实践7 归并排序

def MergeSort(mylist, low, mid, high):
i = low
j = mid + 1
tmp = []

while i <= mid and j <= high:
if mylist[i] <= mylist[j]:
tmp.append(mylist[i])
i = i + 1
else:
tmp.append(mylist[j])
j = j + 1 ......

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写的图片蜘蛛人


    写了个图片蜘蛛人玩玩,抓了几个网页试试,感觉不不错。核心的代码可能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 被和谐了

昨天在研究了几天PHP-GTK后,决定转向Python,因为Python具有多线程这个特点,在与系统交互方面也比较有优势,虽然我很喜欢PHP,PHP在网页方面也非常强大,但毕竟我不是搞网站开发的。
想下个Python吧,发现它居然被和谐了,太诡异了
唉,和谐有理,屏蔽无罪! ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号