How to pass out the result from iterated function
eric
eric at ericaro.net
Wed Dec 10 15:25:27 EST 2008
On Dec 10, 9:16 pm, JD <Jiandong... at gmail.com> wrote:
> I got a iterated function like this:
>
> def iterSomething(list):
> has_something = False
> for cell in list:
> if something in cell:
> has_something = True
> output = something
> if has_something:
> iterSomething(output)
> else:
> final_out = outupt
>
> The problem is how can I read this final_out outside of the function.
> I tried the global statement, it seems not work. Any idea?
>
> JD
why don't you just return it ?
def iterSomething(list):
has_something = False
for cell in list:
if something in cell:
has_something = True
output = something
if has_something:
return iterSomething(output)
else:
return output
?
More information about the Python-list
mailing list