定义
consoleTimeDict = {"默认": 0} def consoleTime(key="默认"): timeStart = time.time() consoleTimeDict[key] = timeStart return timeStart def consoleTimeEnd(key="默认"): timeStart = consoleTimeDict[key] timeEnd = time.time() timeSub = timeEnd - timeStart print("{} 耗时: {:.3f}秒".format(key, timeSub)) return timeSub
使用
consoleTime() JoinVideo() consoleTimeEnd()
结果
默认 耗时: 24.006秒
本文地址
https://www.cnblogs.com/stumpx/p/16555127.html