Why is datetime.strptime not working in this simple example?

前端 未结 6 1171
轻奢々
轻奢々 2020-12-08 09:24

I\'m using strptime to convert a date string into a datetime. According to the linked page, formatting like this should work:

>>> # Usi         


        
6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-08 09:52

    You can also do the following,to import datetime

    from datetime import datetime as dt
    
    dt.strptime(date, '%Y-%m-%d')
    

提交回复
热议问题