Re: global name is not defined - error

2006-06-28 Thread a
i changed it to append and it started working but once in a while i m getting l_code.append( len(d_list_code[i]['entries']) ) IndexError: list index out of range but it is not permanent if i refresh, it goes away! Marco Wahl wrote: > "a" <[EMAIL PROTECTED]> writes: > > > What I want > > --

Re: global name is not defined - error

2006-06-28 Thread Bruno Desthuilliers
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

Re: global name is not defined - error - but for array

2006-06-28 Thread Steve Holden
a wrote: > def fn(): > for i in range(l) >global count >count[i]= > > how do i declare count to be global if it is an array > > subsequently i should access or define count as an array > > error: > global name 'count' is not defined > The questions you are aski

Re: global name is not defined - error - but for array

2006-06-28 Thread Fredrik Lundh
"a" <[EMAIL PROTECTED]> wrote: > def fn(): > for i in range(l) > global count > count[i]= > > how do i declare count to be global if it is an array a couple of notes: 1) global statements should be placed at the top of the function 2) objects don't appear out of now

global name is not defined - error - but for array

2006-06-27 Thread a
def fn(): for i in range(l) global count count[i]= how do i declare count to be global if it is an array subsequently i should access or define count as an array error: global name 'count' is not defined thanks -a -- http://mail.python.org/mailman/listinfo/pyt

Re: global name is not defined - error

2006-06-27 Thread Marco Wahl
"a" <[EMAIL PROTECTED]> writes: > What I want > --- > I want to create a list of items from a function operating on an array > of strings Ok. > What I did > - > list=["s0","s1","s2"] > l=len(list) > for i in range(l): > d_list[i]=f.

global name is not defined - error

2006-06-27 Thread a
What I want --- I want to create a list of items from a function operating on an array of strings What I did - list=["s0","s1","s2"] l=len(list) for i in range(l): d_list[i]=f.do(list[i]) print d_l