grace way to repeat a function

Wojtek Walczak gminick at hacker.pl
Wed Jan 22 08:03:58 EST 2003


Dnia Sun, 19 Jan 2003 17:30:04 +0800, knightmare napisał(a):
> i'm finding a way to repeat a function.used to do like this:
> for i in range(1,10):
>     print "function"
> but i think this not graceful.anyone have good idea ?
def pstr(s, n):
   print (s+"\n") * n,

pstr("function", 10) # prints 'funtcion' 10 times.

-- 
[ ] gminick (at) underground.org.pl  http://gminick.linuxsecurity.pl/ [ ]
[ "Po prostu lubie poranna samotnosc, bo wtedy kawa smakuje najlepiej." ]




More information about the Python-list mailing list