I wrote the following code:
from datetime import datetime
now = datetime.now()
print ‘02d%/02d%/04d%’ %(now.month, now.day, now.year)
print ‘02d%:02d%:02d%’ % (now.hour, now.minute, now.second)
for some reason that I dont understand I am getting the following error:
File “python”, line 3, in
ValueError: unsupported format character ‘/’ (0x2f) at index 4
since when isnt this not supported?
Also, when I represent the same code but in single string like this:
print ‘%02d/%02d/%04d %02d:%02d:%02d’ % (now.month, now.day, now.year, now.hour, now.minute, now.second)
it works fine.