> print "setting " + str(self) + ".cat = \"yellow\"" Maybe you are doing it this way for a reason, but if not, note that you can do it like this in Python: print "setting " + str(self) + '.cat = "yellow"' In other words, you can use either ' or " to delimit strings and then the other one is fine inside of the string.