首先引入time库 计时起始处:start_time = time.time() 计时结束处:end_time = time.time() 打印所用时间:print(’%d second’% (end_time-start_time) %d意为将引号内字符串放于最后,second是单位,%意为取整