日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪(fǎng)問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > python >内容正文

python

时间模块,带Python示例

發(fā)布時(shí)間:2023/12/1 python 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 时间模块,带Python示例 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Python時(shí)間模塊 (Python time Module)

The time module is a built-in module in Python and it has various functions that require to perform more operations on time. This is one of the best modules in Python that used to solve various real-life time-related problems. To use the time module in the program, initially, we have to import the time module.

時(shí)間模塊是Python中的內(nèi)置模塊,它具有各種功能,需要按時(shí)執(zhí)行更多操作。 這是Python中最好的模塊之一,用于解決各種現(xiàn)實(shí)中與時(shí)間相關(guān)的問(wèn)題。 要在程序中使用時(shí)間模塊,首先,我們必須導(dǎo)入時(shí)間模塊 。

This module begins the recording time from the epoch. Epoch means time in history and it begins on 1st January 1970.

此模塊從紀(jì)元開(kāi)始記錄時(shí)間。 歷元是歷史上的時(shí)間,始于1970年1月1日。

時(shí)間模塊的一些重要功能 (Some important function of the time module)

1次() (1) time())

This function returns the number of the second count since the epoch.

此函數(shù)返回自紀(jì)元以來(lái)的第二個(gè)計(jì)數(shù)的編號(hào)。

Example:

例:

# Importing the module import times=time.time() print('Total seconds since epoch:',s)

Output

輸出量

Total seconds since epoch: 1576083939.5877264

2)ctime() (2) ctime())

This function of the time module takes second as an argument and return time till the mentioned seconds.

時(shí)間模塊的此功能以秒為參數(shù),并返回時(shí)間直到提到的秒數(shù)。

Example:

例:

# Importing the module import times=1575293263.821702 Current_time=time.ctime(s) print('current time since epoch:',Current_time)

Output

輸出量

current time since epoch: Mon Dec 2 13:27:43 2019

3)sleep() (3) sleep())

This function is used to stay the program execution for the time given in the arguments of this function.

該函數(shù)用于在該函數(shù)的參數(shù)中指定的時(shí)間內(nèi)保持程序執(zhí)行。

Example:

例:

# Importing the module import timeprint('Execution starting time:',time.ctime()) time.sleep(5) print('After execution time:',time.ctime())

Output

輸出量

Execution starting time: Wed Dec 11 17:10:47 2019 After execution time: Wed Dec 11 17:10:52 2019

4)strftime() (4) strftime())

This function takes an argument and returns a string based on the format code.

該函數(shù)接受一個(gè)參數(shù),并根據(jù)格式代碼返回一個(gè)字符串。

Example:

例:

# Importing the module import timeCurrent_time=time.localtime() time_in_format=time.strftime("%m/%d/%Y, %H:%M:%S",Current_time)print('time in specific format since epoch:',time_in_format)

Output

輸出量

time in specific format since epoch: 12/11/2019, 17:12:47

5)asctime() (5) asctime())

This function takes a tuple of length nine as an argument and returns a string.

此函數(shù)將長(zhǎng)度為9的元組作為參數(shù)并返回一個(gè)字符串。

Example:

例:

# Importing the module import timet=(2019,12,2,5,30,2,7,365,0) r=time.asctime(t) print("Time and date in a specific format:",r)

Output

輸出量

Time and date in a specific format: Mon Dec 2 05:30:02 2019

翻譯自: https://www.includehelp.com/python/time-module-with-example.aspx

總結(jié)

以上是生活随笔為你收集整理的时间模块,带Python示例的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 亚洲乱码国产乱码精品 | 久久视频这里只有精品 | 欧美日韩亚洲另类 | 先锋影音中文字幕 | 国产性70yerg老太 | 亚洲好视频 | 国产色播 | 亚洲天堂免费观看 | √资源天堂中文在线 | 国产美女三级无套内谢 | 中文字幕日韩在线观看 | 香蕉久久夜色精品 | 狼人综合网 | 国产黄色免费在线观看 | 欧美黄色免费视频 | 特级西西人体 | 欧美精品一区二区三区久久 | 黄色av网站在线看 | 中文av在线播放 | 成人免费不卡视频 | 高清日韩一区二区 | 白浆在线播放 | 老鸭窝成人 | 青青操视频在线 | 亚洲永久网站 | av不卡在线 | 国产成人自拍视频在线 | 91视频在线免费 | 成人欧美一区 | 欧美巨鞭大战丰满少妇 | 韩日精品中文字幕 | 国产乱国产 | 日本精品成人 | 日本成人在线免费 | 亚洲男人天堂网址 | 麻豆成人精品国产免费 | 欧美日本一区二区 | 日韩在线精品强乱中文字幕 | 成人在线h| 一区二区三区视频在线免费观看 | 日本黄色免费大片 | 国产二区视频在线观看 | 日韩成人三级 | 日本精品一区二区视频 | 欧美激情在线看 | 色男人在线 | 最新国产精品自拍 | 黄色小说在线看 | 日本韩国欧美一区二区 | 齐天大性床战铁扇公主 | 午夜av免费观看 | 人妻少妇被粗大爽9797pw | 爱情岛论坛亚洲品质自拍视频 | 久久毛片网| 波多野结衣先锋影音 | 国产一级黄色 | 精品国产无码一区二区三区 | 久久久精品一区 | 国产精品伦理一区 | 精品人妻一区二区三区视频 | av男人资源 | 国语对白在线观看 | 大地资源高清播放在线观看 | 日韩欧美精品一区二区三区 | 国产区在线观看 | 不卡的一区二区 | 国产精品1000部啪视频 | 国产日产欧美一区二区 | 啪啪网站免费看 | 成人深夜小视频 | 亚洲精品久久久中文字幕 | 毛片网止| 成年人黄色网址 | 91抖音在线观看 | 好看的中文字幕 | 欧美丝袜一区二区三区 | 欧美亚洲精品在线观看 | 中国免费观看的视频 | 校园春色自拍偷拍 | 日本黄色一区二区三区 | 欧美韩日国产 | 日韩三级不卡 | 久久11| 国产视频一区二区三区在线播放 | 久章草在线观看 | 丰满少妇被猛烈进入高清播放 | 欧美绿帽交换xxx | 日本在线视频观看 | 四虎影视大全 | 国产高清99| 国产电影一区二区三区 | 日本视频中文字幕 | 成人av电影免费观看 | a级黄色片网站 | 亚洲精品www久久久久久广东 | 波波野结衣 | 91超碰国产在线 | 狠狠干狠狠爱 | 7777av|