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
> > --
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
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
"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
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
"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.
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