易截截图软件、单文件、免安装、纯绿色、仅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的exe可执行程序


1. 手动制作python的exe可执行程序
                                      转载---------------
Python没有内建一个编 ......

用Python提取文件夹下的特定扩展名的文件

                用Python提取文件夹下的特定扩展名的文件
      不知道什么时候,网闲着没用,挂了个linux的视屏教程,里面有很多个文件夹,有很多无关的文件。这对于像我没收藏垃圾文件癖好的人来说,简直是 ......

python中package机制的两种实现方式


当执行import
module时,解释器会根据下面的搜索路径,搜索module1.py文件。
1) 当前工作目录
2) PYTHONPATH中的目录
3) Python安装目录
(/usr/local/lib/python)
事实上,模块搜索是在保存在sys.path这个全局变量中的目录列表中进行搜索。
sys.path会在解释器开始执行时被初始化成包含:
1)当前工作目录
2) PYT ......

用 Python 3 写的命令行百度词典

今天是第二天自己看关于Python了,看见一个Python2写的百度词典,我也用Python 3 写了一个。真的很小巧,呵呵,很好的语言。
不知道怎么上传代码格式的,就上传文本了:
# -*- coding: utf8 -*-
import urllib.parse
import urllib.request
def search(word):
    #word = input("输入你要查询的 ......

python读取目录下文件并生成日志

很长的一段代码,但很清楚。哈哈。
import os
from time import strftime
stamp=strftime("%Y-%m-%d %H:%M:%S")
logfile = 'F:\\test\\m-php-framework\\tmp\logs\\error_report.log'
path = 'F:\\test\\'
files = os.listdir(path)
bytes = 0
numfiles = 0
for f in files:
if f.startswith('t'): ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号