Answers for "python 10 seconds timer"

16

python time a funciton

import time

start = time.time()
print("hello")
end = time.time()
print(end - start)
Posted by: Guest on December-08-2020
0

python stopwatch

1 # latest_tutorial.py
 2 
 3 import time
 4 from reader import feed
 5 
 6 def main():
 7     """Print the latest tutorial from Real Python"""
 8     tic = time.perf_counter()
 9     tutorial = feed.get_article(0)
10     toc = time.perf_counter()
11     print(f"Downloaded the tutorial in {toc - tic:0.4f} seconds")
12 
13     print(tutorial)
14 
15 if __name__ == "__main__":
16     main()
Posted by: Guest on October-11-2020

Python Answers by Framework

Browse Popular Code Answers by Language