这是一个自答题。我已经写了一个答案,但如果你有更好的答案,请发布。
我正在开发一个程序并打印一些时间结果:
$ homa.py
Creating instance rd = NetworkInfo(): 0.0071680546
Creating instance rd = NetworkInfo(): 0.0083100796
Creating instance rd = NetworkInfo(): 0.0121581554
Creating instance rd = NetworkInfo(): 0.0205171108
Creating instance rd = NetworkInfo(): 0.0067570210
Creating instance rd = NetworkInfo(): 0.0215399265
Creating instance rd = NetworkInfo(): 0.0170729160
Creating instance rd = NetworkInfo(): 0.0088560581
Creating instance rd = NetworkInfo(): 0.0079369545
Creating instance rd = NetworkInfo(): 0.0091099739
Creating instance rd = NetworkInfo(): 0.0085971355
Creating instance rd = NetworkInfo(): 0.0137989521
Creating instance rd = NetworkInfo(): 0.0081419945
Creating instance rd = NetworkInfo(): 0.0090279579
Creating instance rd = NetworkInfo(): 0.0070800781
Creating instance rd = NetworkInfo(): 0.0079300404
^C
homa.py refresh() closed by SIGTERM
看一眼列表并得到平均时间太困难了。
如何才能快速得到平均时间?