Step five the time of the Python module

Source: Internet
Author: User

The time module, as the name implies, is the module that provides it.

1, time stamp time.time ()

Import time >>> time.time (1522277717.8651874)

The return value is large and the unit is "seconds". The number of seconds between the starting point of January 1, 1970 and the time you use Time.time ().

What is the role of this time stamp? Can be used for timing, such as how much time an operation takes.

2, Sleep Time.sleep ()

Enter both ends of the code together

if a>1:    print(a)    10

After entering print (a) carriage return, the system will print the value of a 10 immediately.

Look at the code again.

if a>1:    time.sleep (5)    print(a)    10

Before print (a), add a line of code Time.sleep (5). This means that the system sleeps for 5 seconds before printing the value of a. Enter the code, we feel the above two pieces of code differences.

3.

Step five the time of the Python module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.