Printing strings


Code works fine as expected.

I don't expect the code to print the string as it is in single quotes. But it prints even without double quotes.

from datetime import datetime
now =

print '%s/%s/%s' % (now.month,, now.year,)


Nothing wrong with using either '' or "" for this kind of situation. Both are meant as strings.
If you want to know more about the difference between '' or "" for strings, this link is a nice start.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.