易截截图软件、单文件、免安装、纯绿色、仅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安装MySQLDb模块的种种问题及解决


我的环境是:Linux version 2.4.21-4.EL
(bhcompile@daffy.perf.redhat.com) (gcc version 3.2.3 20030502 (Red Hat
Linux 3.2.3-20)) #1 Fri Oct 3 18:13:58 EDT 2003 + Python2.6.4
本文结合我安装时候的问题,总结而成
用户目录如/home/liuguanyu/ , 保证用户有root权限
1,看看有没有安装
 &nbs ......

python动态导入模块、检查模块是否安装

参考链接:http://www.woodpecker.org.cn/diveintopython/functional_programming/dynamic_import.html
一 动态导入模块
Python的import不能接受变量,所以应该用 __import__函数来动态导入。
如下的代码无法正常导入模块
modules = ['OpenSSL', 'Crypto', 'MySQLdb', 'sqlite3', 'zope.interface', 'pyasn1', 'twisted ......

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 参数知识(变量前加星号的意义)

过量的参数
在运行时知道一个函数有什么参数,通常是不可能的。另一个情况是一个函数能操作很多对象。更有甚者,调用自身的函数变成一种api提供给可用的应用。
对于这些情况,python提供了两种特别的方法来定义函数的参数,允许函数接受过量的参数,不用显式声明参数。这些“额外”的参数下一步再解释。
注意a ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号