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