1. タイムスタンプ time.time 現在の時刻。
2. time.sleep プログラムは 3 秒間一時停止します。
3. time.ctime 現在の時刻。
年、月、日、時、分、秒。
4. time.localtime() はタイムスタンプをタプルに変換します。
現在時刻の詳細情報を表示します。
time.mktime は時間タプルをタイムスタンプに変換します。
time.strftime()#タプル時間を文字列形式に変換します。
time.strptime()#文字列をタプルに変換します。
例
import time t1 = time.time() print(t1) #程序至此的执行时间 # time.sleep(3) #程序至此暂停3秒 t2 = time.time() print(t2) s = time.ctime(t1) #当前时间 print(s) #将时间戳转换为元组的形式(当前时间详细信息显示) loc = time.localtime(t1) print(loc) print(loc.tm_hour) #可调用元组里的具体内容 print(loc.tm_mon) #将(时间)元组转为时间戳的形式 loc = time.mktime(loc) print(loc) #小数点后清零 #将元组时间 转为字符串形式 s = time.strftime('%Y-%m-%d') print(s) #以年月日的形式打印 s = time.strftime('%Y-%m-%d %H:%M:%S') print(s) #将字符串转成元组的方式 t = time.strptime('2021/9/13','%Y/%m/%d') #第一个参数为时间字符串,第二个参数为待转换的格式 print(t)
以上がPythonのtimeモジュールのメソッドは何ですか?の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

pythonusesahybridmodelofcompilation andtertation:1)thepythoninterpretercompilessourcodeodeplatform-indopent bytecode.2)thepythonvirtualmachine(pvm)thenexecuteTesthisbytecode、balancingeaseoputhswithporformance。

pythonisbothintersedand compiled.1)it'scompiledtobytecode forportabalityacrossplatforms.2)bytecodeisthenは解釈され、開発を許可します。

loopsareideal whenyouwhenyouknumberofiterationsinadvance、foreleloopsarebetterforsituationsは、loopsaremoreedilaConditionismetを使用します

henthenumber ofiterationsisknown advanceの場合、dopendonacondition.1)forloopsareideal foriterating over for -for -for -saredaverseversives likelistorarrays.2)whileopsaresupasiable forsaresutable forscenarioswheretheloopcontinupcontinuspificcond

pythonisnotpurelyLepted; itusesahybridapproachofbytecodecodecodecodecodecodedruntimerttation.1)pythoncompilessourcodeintobytecode、whodythepythonvirtualmachine(pvm).2)

ToconcatenateListsinpythothesheElements、使用:1)Operatortokeepduplicates、2)asettoremoveduplicates、or3)listcomplunting for controloverduplicates、各メトドハスディフェルフェルフェントパフォーマンスアンドソーダーインプリテーション。

pythonisantertedlanguage、useaseofuseandflexibility-butfactingporformantationationsincriticalapplications.1)解釈されたlikepythonexecuteline-by-lineを解釈します

Useforloopswhenthenumberofiterationsisknowninadvance、andwhiloopswheniterationsdependonacondition.1)forloopsareidealforsecenceslikelistoranges.2)


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

SublimeText3 Linux 新バージョン
SublimeText3 Linux 最新バージョン

ZendStudio 13.5.1 Mac
強力な PHP 統合開発環境

SecLists
SecLists は、セキュリティ テスターの究極の相棒です。これは、セキュリティ評価中に頻繁に使用されるさまざまな種類のリストを 1 か所にまとめたものです。 SecLists は、セキュリティ テスターが必要とする可能性のあるすべてのリストを便利に提供することで、セキュリティ テストをより効率的かつ生産的にするのに役立ちます。リストの種類には、ユーザー名、パスワード、URL、ファジング ペイロード、機密データ パターン、Web シェルなどが含まれます。テスターはこのリポジトリを新しいテスト マシンにプルするだけで、必要なあらゆる種類のリストにアクセスできるようになります。

WebStorm Mac版
便利なJavaScript開発ツール

PhpStorm Mac バージョン
最新(2018.2.1)のプロフェッショナル向けPHP統合開発ツール
