zzzzf
发表于 2017-12-20 10:53:42
good job
1302549490
发表于 2017-12-20 12:00:59
{:10_265:}
cupbbboom
发表于 2017-12-20 22:26:59
0
lyhlyh199243
发表于 2017-12-21 14:26:00
{:5_107:}
流年肆意
发表于 2017-12-21 20:32:28
谢谢,回复后查看代码。
767280220
发表于 2017-12-21 22:45:11
感谢
2323
simpleman1983
发表于 2017-12-25 14:56:56
学习学习
Ifound
发表于 2017-12-26 22:48:23
1
小呼吸
发表于 2017-12-28 10:02:50
666
napyc
发表于 2017-12-28 11:24:46
学习学习
land1725
发表于 2017-12-28 14:36:50
看看实现
hehehaha4334
发表于 2017-12-30 21:42:01
感谢教学
球磨川禊
发表于 2017-12-31 20:04:26
what
1017630959
发表于 2018-1-2 17:44:36
想看源代码!
男二号cyy
发表于 2018-1-3 11:24:55
{:5_90:}
LOLL哇哇哇
发表于 2018-1-3 18:13:22
士大夫
六神
发表于 2018-1-3 22:31:00
1
zgc911013
发表于 2018-1-3 23:11:18
ererererere
pahriyad
发表于 2018-1-4 18:09:28
import time as t
class MyTimer:
def __init__(self, func, number=1000000):
self.prompt = ("未开始计时!")
self.lasted= 0.0
self.default_timer = t.perf_counter
self.func = func
self.number = number
def __str__(self):
return self.prompt
__repr__ = __str__
def __add__(self, other):
result = self.lasted + other.lasted
prompt = "总共运行了%0.2f 秒" % result
return prompt
#内部方法,计算运行时间
def timing(self):
self.begin = self.default_timer()
for i in range(self.number):
self.func()
self.end = self.default_timer()
self.lasted = self.end - self.begin
self.prompt = "总共运行了%0.2f 秒" % self.lasted
#设置计时器(time.perf_counter()或time.process_time())
def set_timer(self, timer):
if timer == "process-time":
self.default_timer = t.process_time
elif timer == "perf_counter":
self.default_timer = t.perf_counter
else:
print("输入无效,请输入perf_counter或process_time")
caosunli
发表于 2018-1-6 15:00:04
{:5_91:}