資源簡介
python 實現(xiàn)關鍵字查詢代碼,可以查詢指定文件或者文件夾內關鍵字,統(tǒng)計出關鍵字次數(shù)和高亮顯示關鍵字所在位置。

代碼片段和文件信息
#-*-?encoding:?utf-8?-*-
#author?:?rayment
#CreateDate?:?2012-07-04
#version?1.1
import?datetime
import?time
def?getTime():
????‘‘‘
????return?time?is?format?of?time(unit?is?second)
????‘‘‘
????return?time.time()
def?getCPUClockTime():
????‘‘‘
????return?time?is?CPU?Clock?time
????‘‘‘
????return?time.clock()
def?formatTime(timevalue):
????‘‘‘
????format?the?time?numbers
????‘‘‘
????hour?=?0
????minute?=?0
????second?=?0
????if?timevalue?>?0:
????????#count?hour
????????hour?=?timevalue?//?3600
????????remain?=?timevalue?%?3600
????????#count?minute
????????minute?=?remain?//?60
????????remain?=?remain?%?60
????????#count?second
????????second?=?round(remain?3)
????return?‘%.0fh:%.0fm:%.3fs‘%(hour?minute?second)
????????
if?__name__==‘__main__‘:
????value?=?134.45632
????print?value
????print?formatTime(value)
????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????882??2012-07-17?16:19??Search\countTime.py
?????文件???????1043??2012-07-21?12:29??Search\countTime.pyc
?????文件???????4187??2012-07-21?12:30??Search\search.py
?????目錄??????????0??2012-07-21?15:23??Search
-----------?---------??----------?-----??----
?????????????????6112????????????????????4
- 上一篇:Python 搜狗詞庫的批量
- 下一篇:vgg_easy.py
評論
共有 條評論