global name is not defined - error

Bruno Desthuilliers onurb at xiludom.gro
Wed Jun 28 12:23:57 CEST 2006

a wrote:
> What I want
> ---------------
> I want to create a list of items from a function operating on an array
> of strings

def func(s):
  return s.upper()

arrayOfStrings = ['bicycle', 'repair', 'man']

print "solution 1: with map()"
print map(func, arrayOfStrings)
print "solution 2: with list comprehension"
print [func(s) for s in arrayOfStrings]

bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"

More information about the Python-list mailing list