import math
from tqdm import tqdmimport timetotal,s,n,t=0.0,1,1.0,1.0while(math.fabs(t)>=1e-6): total+=t n+=2 s=-s t=s/nk=total*4print("π值是{:.10f} 运行时间为{:.4f}秒".format(k,time.clock()))for i in tqdm(range(101)): print("\r{:3}%".format(i),end="") time.sleep(0.1)原文:https://www.cnblogs.com/1234just/p/13842108.html