目標網址
http://www.8manga.com/manga
海賊王漫畫從此
http://www.8manga.com/manga/1002.html
2012年2月5日 星期日
2012年2月3日 星期五
UMplayer 快速下載youtube影音
- 參考來源 :來自痞克幫
- 軟體名稱:UMPlayer
- 語言介面:支援繁體中文
- 購買金額:免費
- 下載網址:http://www.umplayer.com/
- 支援格式:AAC, AC3, ASF, AVI, DIVX, FLV, H.263, Matroska, MOV, MP3, MP4, MPEG, OGG, QT, RealMedia, VOB, Vorbis, WAV, WMA, WMV, XVID……等,完整清單請見官方說明
- 快捷功能按鈕
- 功能列
- 搜尋YouTube影片
在播放畫面,點選左下角的紅色錄影鍵即可線上儲存YouTube影片。
2012年2月1日 星期三
python 用time模組,timeit模組 測量python function 執行的時間
# -*- coding: utf-8 -*-
import time
tStart = time.time()#計時開始
#模擬要測量的function
time.sleep(2)
print "abc"
for x in range(1000):
x += 1
print x
#end of 模擬要測量的function
tEnd = time.time()#計時結束
#列印結果
print "It cost %f sec" % (tEnd - tStart)#會自動做近位
print tEnd - tStart#原型長這樣
Let's timeit!
Every now and then you might want to time snippets just to make sure that you choose the more efficient solution. In those cases you can use the timeit module to measure execution time for snippets.
Introduction
It's very easy to setup and measure the execution time for a snippet with timeit. The module contains a class, Timer, which is used to perform the measurement. The class has one constructor and three methods:Starting with Python 2.6 the timeit module also defines two convenience functions,timeit.timeit() and timeit.repeat(). They are basically wrappers around the Timer class.
- Timer([stmt='pass'[, setup='pass'[, timer=<timer function>]]]) - stmt is the statement to be timed and setup is called once before executing the main statement. A timer function can be specified and default is time.time() for all platforms but windows which is set to time.clock() instead (according to my timeit.py)
- timeit([number=1000000]) - Executes the main statement passed to the constructornumber of times and returns the result in seconds as a float.
- repeat([repeat=3[, number=1000000]]) - Convenience function that callstimeit(number) repeat times. Returns a list with the results.
- print_exc([file=None]) - Helper to print a traceback from the timed snippet.
Example
Suppose that I would like to create a list containing 100 'c':s like this ['c', 'c', ...]. There are at least two ways of doing this:Which one should I choose? Well, let's execute both statements with timeit and measure the execution time.
- lst = ['c'] * 100
- # or
- lst = ['c' for i in xrange(100)]
Ok, I think I'll stick with the first snippet :)
- >>> import timeit
- >>> t = timeit.Timer(stmt="lst = ['c'] * 100")
- >>> print t.timeit()
- 1.10580182076
- >>> t = timeit.Timer(stmt="lst = ['c' for x in xrange(100)]")
- >>> print t.timeit()
- 7.66900897026
The result returned is the total execution time in seconds. In this particular case when we are executing the snippet 1000000 times the result is also the execution time in microseconds for one single pass (1000000*exe_time/1000000 == exe_time).
Normally, the timeit module doesn't have access to things that you have defined in your module. If you would like to measure a function that you have defined in your module you can specify the import statement in the setup parameter:This will introduce a little overhead since the create_lst() function is called in the measurement loop instead of just executing an inlined snippet.
- >>> def create_lst(size):
- ... return ['c'] * size
- ...
- >>> t = timeit.Timer(stmt="create_lst(100)", setup="from __main__ import create_lst")
- >>> print t.timeit()
- 1.21339488029
Note: Timer.timeit() will by default disable garbage collection during timing. To enable GC you can pass 'gc.enable()' as a setup statement.I find the timeit module as a simple and convenient way to measure execution time for small snippets.
訂閱:
意見 (Atom)