Python List length as a string

Posted by mvid on Stack Overflow See other posts from Stack Overflow or by mvid
Published on 2010-04-15T17:41:03Z Indexed on 2010/04/15 17:43 UTC
Read the original article Hit count: 168

Filed under:
|
|

Is there a preferred (not ugly) way of outputting a list length as a string? Currently I am nesting function calls like so:

print "Length: %s" % str(len(self.listOfThings))  

This seems like a hack solution, is there a more graceful way of achieving the same result?

© Stack Overflow or respective owner

Related posts about python

Related posts about conventions