Python 字符串转换成时间

r[0] = '20181026'
dtr = datetime.datetime.strptime(r[0], "%Y%m%d")
finalR = dtr.strftime("%Y-%m-%d")

'2018-10-26'

参考:

https://www.cnblogs.com/alfred0311/p/7885349.html

猜你喜欢

转载自blog.csdn.net/Hodors/article/details/114869388