Python

4f4288a0 :Anonymous 2008-03-13 01:44
string.find() より “in” のほうが速い。

import timeit
print timeit.Timer('“a“ in “cba“').timeit() # 0.0949950218201
print timeit.Timer('“a“.find(“cba“)').timeit() # 0.358776092529
Powered by shinGETsu.