Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 503 Bytes

48 怎么将字符串转为时间元组.md

File metadata and controls

13 lines (9 loc) · 503 Bytes

Python100

把Python知识点整理成100道习题,知识点来自两本书:Python基础教程(第3版)和流畅的Python,以后会定期加入更多的习题,大家帮忙点个赞哈,点赞越多,更新越快~

怎么将字符串转为时间元组

用 time 模块里的 strptime 方法

>>> import time
>>> time.strptime('Sun Jul  5 08:29:51 2020')
time.struct_time(tm_year=2020, tm_mon=7, tm_mday=5, tm_hour=8, tm_min=29, tm_sec=51, tm_wday=6, tm_yday=187, tm_isdst=-1)