Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 Get Key press

refer from:  http://www.daniweb.com/forums/thread115282.html#
python
Syntax
(Toggle Plain Text
)

# respond to a key
without the need to press
enter
 
import
Tkinter
as tk
 
def
keypress(
event)
:
if
event.keysym
== 'Escape'
:
root.destroy
......

»°ËµPython£¨Î壩¿ªÊ¼Æð·É°É

    С°×¶ÔÉϽڿÎÀïµÄ“СÂéȸ”ÐËȤ°»È»£¬ÕûÌì¾ÍÔÚËÞÉáµ·¹Ä¡£Õâ²»£¬¼¸ÌìÏÂÀ´ËûÒѾ­¹¥ÏÂÊ®¼¸¸öÍøÕ¾ÁË¡£
С²Ëȴϲ»¶Ò»¸öÈË×øÔÚµçÄÔÅԱߣ¬Öå×Åüͷ£¬ÐÀÉÍ×ÅÕâÒ»ÐÐÐÐ×Ô¼º¿´²»¶®µÄ´úÂë¡£“ÕâЩ×Ö·ûºÃ¹ÖÒìѽ£¡”С²ËÍá×ÅÍ·£¬“ËüΪɶ½ÐÕýÔò±í´ïÊ½ÄØ£¿”
°Ù¶Èһϣ¬ÖÕÓÚÖªµÀ¡£Ð¡² ......

Óà Python 3 дµÄÃüÁîÐаٶȴʵä

½ñÌìÊǵڶþÌì×Ô¼º¿´¹ØÓÚPythonÁË£¬¿´¼ûÒ»¸öPython2дµÄ°Ù¶È´Êµä£¬ÎÒÒ²ÓÃPython 3 дÁËÒ»¸ö¡£ÕæµÄºÜСÇÉ£¬ºÇºÇ£¬ºÜºÃµÄÓïÑÔ¡£
²»ÖªµÀÔõôÉÏ´«´úÂë¸ñʽµÄ£¬¾ÍÉÏ´«Îı¾ÁË£º
# -*- coding: utf8 -*-
import urllib.parse
import urllib.request
def search(word):
    #word = input("ÊäÈëÄãÒª²éѯµÄ ......

Python¡¢UnicodeºÍÖÐÎÄ[ת]


¹Ø¼ü×Ö: python
Python¡¢UnicodeºÍÖÐÎÄ[ת] 
pythonµÄÖÐÎÄÎÊÌâÒ»Ö±ÊÇÀ§ÈÅÐÂÊÖµÄÍ·ÌÛÎÊÌ⣬ÕâÆªÎÄÕ½«¸øÄãÏêϸµØ½²½âÒ»ÏÂÕâ·½ÃæµÄ֪ʶ¡£µ±È»£¬¼¸ºõ¿ÉÒÔÈ·¶¨µÄÊÇ£¬ÔÚ½«À´µÄ°æ±¾ÖУ¬python»á³¹µ×½â¾ö´ËÎÊÌ⣬²»ÓÃÎÒÃÇÕâôÂé·³ÁË¡£ 
ÏÈÀ´¿´¿´pythonµÄ°æ±¾£º 
>>> import sys 
>> ......

python´¦ÀíXML

»ù±¾É϶¼ÊÇʹÓÃpythonÀ´½âÎöxmlÎļþµÄ¡£
±ÈÈçÎÒÒª½«ÄÚÈÝΪ
<?xml version="1.0" encoding="utf-8"?>
    <root>
        <book isbn="34909023">
            <author>
 &n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ