[Tutor] Multifunction mapping

alan.gauld@bt.com alan.gauld@bt.com
Wed, 1 May 2002 17:56:32 +0100


> I have a sequence of characters  (a,b,c,d,e,f,g,h,i)
I assume they are meant to have quotes around them? 
Otherwise they are a list of variables!

> (61,62,63,64,65,66,67,68,69)
OK
> (061,062,063,064,065,066,067,068,069)
and these must be strings since the leading 
zero has no significance for an int...?

> (061062063064065066067068069)
And this is one big string...?


def fixChar(c):
   s = ord(c)
   s = '0%d' % i  #get string    
   return s

string.join(map(fixChar, letters))

Something like that - sorry no python to test it...

Alan g.
Author of the 'Learning to Program' web site
http://www.freenetpages.co.uk/hp/alan.gauld