Hello! I'm having troubles understanding what is the difference between %s and %r(format characters). I did google and found something on StackOverflow but I don't understand the explanation as it's not beginner orientated.
Also, I have this code from learn python the hard way. Why at line 9 does he uses %r? Why did he didn't wrote print "I said: %s." %x ? 1 x = "There are %d types of people." % 10 2 binary = "binary" 3 do_not = "don't" 4 y = "Those who know %s and those who %s." % (binary, do_not) 5 6 print x 7 print y 8 9 print "I said: %r." % x 10 print "I also said: '%s'." % y 11 12 hilarious = False 13 joke_evaluation = "Isn't that joke so funny?! %r" 14 15 print joke_evaluation % hilarious 16 17 w = "This is the left side of..." 18 e = "a string with a right side." 19 20 print w + e Thanks in advance!
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor