Hot Date: Not All Arguments Converted During String Formatting


#1

More than likely I made some mistake in the formatting but the error I keep getting is Your code threw the following error: not all arguments converted during string formatting


from datetime import datetime
now = datetime.now()

print '08/16/2016' % (now.month, now.day, now.year)


#2

This is just a raw string. I suggest you go over the lesson on string formatting/ advanced printing to understand what is going on there because it looks like you did not really grasp the concept.


#3

Well sir, while that is great advice, and in fact I have already done that, this does not help me at all. Granted, from looking back at the previous lessons I probably should be able to tell what is wrong. However, I cannot. While this might be annoying to some I still need some help to see my error in the string. It might be simple and I will probably feel silly for asking but I would still like something even if just a hint or another forum discussion to help me see what I missed in those lessons to learn how complete this lesson.


#4

You need to put a %s in place of all the numbers in that string.

Perhaps read the little tutorial here to help

http://www.python-course.eu/python3_formatted_output.php


#5

Thank you very much! The tutorial is very nice as well for someone just starting on python :smiley: I will make sure to hang on to this resource


#6

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