How to generate a continuous string

Michael Bentley michael at jedimindworks.com
Mon Apr 16 06:11:37 EDT 2007


On Apr 16, 2007, at 5:03 AM, 人言落日是天涯,望极天涯不 
见家 wrote:

> How to generate a continuous string, like this
> "aaaaaaaaaaaaaaaaaaaaaaa"
> the number of characters is dynamic. Is there a module or function
> implement this string ?
> such as: duplicate_string(char, num)

It's even easier than that -- just multiply:

 >>> 'a' * 32
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'




More information about the Python-list mailing list