Python3学习(二十八):python 如何获取毫秒级系统时间

在datetime模块,使用格式化符号 '%f'。

import datetime

time_now = datetime.datetime.now().strftime('%H:%M:%S.%f')
print(time_now)

%H Hour (24-hour clock) as a decimal number [00,23].

%M Minute as a decimal number [00,59].

%S Second as a decimal number [00,61].

%f Microsecond as a decimal number [0,999999], zero-padded on the left.

你可能感兴趣的:(Python,python)