Reputation: 523
I'd like to convert date to such format:
2017%2C01%2C02
was trying to do this using:
date.strftime('%Y%2Cm%2Cd')
But is doesn't work.
Can anyone explain what I am doing wrong and how to solve it ?
Thanks,
Upvotes: 0
Views: 31
Reputation: 75
In order for strftime
to print % as a literal string, you need to escape it by doing %%
. You also need to add another %
in front of m
and d
like you did with Year, if you want them to be replaced by actual month and dates.
This cheat sheet is quite helpful.
Upvotes: 1