python用time计算程序耗时
# python3
import time
start = time.perf_counter()
***
your code and function
***
elapsed = (time.perf_counter() - start)
print("耗时: ",elapsed)
time包有多种用法,不局限此描述方法,输出结果没有单位,我估计是ms
# python3
import time
start = time.perf_counter()
***
your code and function
***
elapsed = (time.perf_counter() - start)
print("耗时: ",elapsed)
time包有多种用法,不局限此描述方法,输出结果没有单位,我估计是ms
1.while循環的格式 while 條件: 條件滿足時,做的事情1 條件滿足時,做的事情2 條件滿足時,做的事情3 ...(省略)... demo