Re: How to generate a continuous string

2007-04-16 Thread Amit Khemka

On 16 Apr 2007 03:03:26 -0700, 人言落日是天涯,望极天涯不见家 <[EMAIL PROTECTED]> wrote:

How to generate a continuous string, like this
"aaa"
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,

--

Amit Khemka -- onyomo.com
Home Page: www.cse.iitd.ernet.in/~csd00377
Endless the world's turn, endless the sun's Spinning, Endless the quest;
I turn again, back to my own beginning, And here, find rest.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to generate a continuous string

2007-04-16 Thread Michael Bentley

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

> How to generate a continuous string, like this
> "aaa"
> 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
''

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to generate a continuous string

2007-04-16 Thread [EMAIL PROTECTED]
On 16 avr, 12:03, "人言落日是天涯,望极天涯不见家" <[EMAIL PROTECTED]> wrote:
> How to generate a continuous string, like this
> "aaa"
> the number of characters is dynamic. Is there a module or function
> implement this string ?
> such as: duplicate_string(char, num)

>>> "a"*10
'aa'
>>> "a"*20
''
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to generate a continuous string

2007-04-16 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>,
人言落日是天涯,望极天涯不见家 wrote:

> How to generate a continuous string, like this
> "aaa"
> 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]: 'a'

Ciao,
Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

How to generate a continuous string

2007-04-16 Thread 人言落日是天涯,望极天涯不见家
How to generate a continuous string, like this
"aaa"
the number of characters is dynamic. Is there a module or function
implement this string ?
such as: duplicate_string(char, num)

-- 
http://mail.python.org/mailman/listinfo/python-list