when uses time.clock,there are always mistakes

Peter Otten __peter__ at web.de
Mon Feb 3 09:59:43 EST 2020


石盼 wrote:

> The problem like this:

> t = time.clock()
> AttributeError: module 'time' has no attribute 'clock'

Quoting
https://docs.python.org/3/whatsnew/3.8.html#api-and-feature-removals

"""
The function time.clock() has been removed, after having been deprecated 
since Python 3.3: use time.perf_counter() or time.process_time() instead, 
depending on your requirements, to have well-defined behavior. (Contributed 
by Matthias Bussonnier in bpo-36895.)
"""



More information about the Python-list mailing list