import datetime

dd = '2021-08-05 11:02:05.134000'
#转为datetime格式
dd = datetime.datetime.strptime(dd, "%Y-%m-%d %H:%M:%S.%f")
print(dd, type(dd))
#转为str
dc = dd.strftime("%Y-%m-%d %H:%M:%S.%f")
print(dc)