Problem with join in__str__() in class (newbie)

jon rascal jonrascal at gmail.com
Sun Aug 9 19:28:13 CEST 2009


> def __str__(self):
>      output = '%s:%s' % (self.expert_id, self.name)
>      output += '\nKnown topics: %s' % (', '.join(str(self.topics)))

You're turning your list into a string -- try this:
', '.join([str(x) for x in self.topics])



More information about the Python-list mailing list