python-small-examples

@author jackzhenguo
@desc 
@date 2019/10/16

116 字符时间转时间

from time import strptime

# parse str time to struct time
struct_time = strptime('2019-12-22 10:10:08', "%Y-%m-%d %H:%M:%S")
print(struct_time) # struct_time类型就是time中的一个类

# time.struct_time(tm_year=2019, tm_mon=12, tm_mday=22, tm_hour=10, tm_min=10, tm_sec=8, tm_wday=6, tm_yday=356, tm_isdst=-1)
[上一个例子](/python-small-examples/md/115.html) [下一个例子](/python-small-examples/md/117.html)