How to generate a continuous string

G

Guest

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)
 
M

Marc 'BlackJack' Rintsch

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)

Even easier: multiply the string by a number.

In [12]: 'a' * 5
Out[12]: 'aaaaa'

Ciao,
Marc 'BlackJack' Rintsch
 
C

charles.hebert

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)
'aaaaaaaaaaaaaaaaaaaa'
 
M

Michael Bentley

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:
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
 
A

Amit Khemka

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)

mystr = mychar*n
n: Integer (number of times you want to duplicate)

Cheers,

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top