Returning a string

Diez B. Roggisch deets at nospam.web.de
Sat Jan 3 14:51:16 EST 2009


Kless schrieb:
> On 3 ene, 19:40, Simon Forman <sajmik... at gmail.com> wrote:
>> On Jan 3, 11:20 am, Kless <jonas.... at googlemail.com> wrote:
>>
>>> Afghanistan
>>> AF
>>> Out[19]: u'AF'
>>> AFG
>>> Out[19]: u'AFG'
>>> 004
>>> Out[19]: u'004'
>> What?
> 
> That's the output got from ipython. As you can see, it prints
> 'Afghanistan' but it can not returns it. In change, the another
> strings are returned.
> 
> Could it be because it isn't returning the value from the
> recursivecall?

Yep, I guess that's the problem. You need to do

if cell_tag:
    return clean_tags(cell_tag)


Diez



More information about the Python-list mailing list