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

Python 处理excel并转为table

使用xlrd

读取,xlrd的下载及安装可以参看:
Python
"xlrd" package for extracting data from Excel files
---------------------------------------------------------------------------------
#coding=utf-8
import xlrd
import os, types, datetime
#excel存放目录
dir = u'D:\\temp\\excel'
#生成html存放目录,需要事先建立
htmlroot = u'D:\\temp\\html'
#excel从1899/12/31计算时间
__s_date = datetime.date(1899, 12, 31).toordinal() - 1
#读取时间格式的单元
def getdate(date):
    if isinstance(date, float):
        date = int(date)
    d = datetime.date.fromordinal(__s_date + date)
    return d.strftime("%Y-%m-%d")
#遍历文件夹
for root, dirs, files in os.walk(dir):
    for file in files:
        #生成excel文件路径
        path = os.path.join(root, file)
        print u'converting...   ' + path
      
        book = xlrd.open_workbook(path) #打开excel文件
      
        #遍历excel文件中的sheet
        for shn in range(book.nsheets):
            sh = book.sheet_by_index(shn)
            #判断该表是否为空
            if sh.nrows == 0:
                continue
          
            #搜索“路径”列
 &nbs


相关文档:

Python语言概览

python
语言概览
 
python
脚本可以处理外部传进来的参数 即sys.argv[] 
,argv[]
的使用与linux
下相同
python
本身是解释语言,可以对输入的式子求值。python
支持的对象如整数都是立即数,此外他支持复数,及对四则运算解释。
ptyhon
支持字符串,放在单/
双引号内,字符串是数组,可以通过[i: ......

在ubuntu上编译vim并带有python支持

ubuntu10.05出来了这两天一直在折腾,显示wubi无反应,然后从硬盘安装期间又遇到grub错误等问题。安装成功后搞个中文输入法就老半天,最后使用Pinyin这个还算好用,有点想搜狗就是没什么词库。最恶心的还是vim的问题,用apt-get install vim装的vim不支持系统剪切板,只好从源代码编译,可是我尝试了很多次总是没有python支 ......

Python、Unicode和中文[转]


关键字: python
Python、Unicode和中文[转] 
python的中文问题一直是困扰新手的头疼问题,这篇文章将给你详细地讲解一下这方面的知识。当然,几乎可以确定的是,在将来的版本中,python会彻底解决此问题,不用我们这么麻烦了。 
先来看看python的版本: 
>>> import sys 
>> ......

关于Python中时间与字符串直接的转换

>>> import time
>>> import datetime
>>>
now = time.localtime()
>>> now
(2006, 4, 30, 18, 7, 35,
6, 120, 0)
>>> type(now)
<type 'time.struct_time'>
>>>
str_now = time.strftime("%m/%d/%Y %X", now )
>>>
str_n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号