In Python, how do I create a string of n characters in one line of code?

Posted by Thierry Lam on Stack Overflow See other posts from Stack Overflow or by Thierry Lam
Published on 2009-09-14T21:26:10Z Indexed on 2010/05/04 0:48 UTC
Read the original article Hit count: 275

Filed under:
|
|

I need to generate a string with n characters in Python. Is there a one line answer to achieve this with the existing Python library? For instance, I need a string of 10 letters:

string_val = 'abcdefghij'

© Stack Overflow or respective owner

Related posts about python

Related posts about one-liner