How can I convert a string such as:
'20190501'
To a string such as:
'2019-05-01'
Without first converting to datetime, for example:
from datetime import datetime
datetime.strptime('20190501', '%Y%m%d').strftime('%Y-%m-%d'))
The above code works, however since I'm starting and ending with a string, it seems unnecessary to use datetime
in the process. Can I convert the string directly?