Posted By

newtonapple on 08/10/06


Tagged

python String performance optimization


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

anayhk
fukami
taboularasa


Most Pythonic (and effecient way) to do string concatenation


 / Published in: Python
 

URL: http://www.skymind.com/~ocrow/python_string/

Performance can be seen in link. This code, however, uses generator expression instead of list comprehension.

  1. ''.join( num for num in xrange(100000) )

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: pulczynski on March 21, 2008

TypeError: sequence item 0: expected string, int found

''.join( str(num) for num in xrange(100000) )

You need to login to post a comment.