Error in Chain of Function calls

Fredrik Lundh fredrik at pythonware.com
Fri Jun 9 09:52:58 CEST 2006


Girish Sahani wrote:

> However i am getting an error at the line marked with ***.

what error ?

> Also,i am getting a ValueError in the code below:
> 
>               for s in prunedNew:
>                 substrings = [s[:i]+s[i+1:] for i in range(len(s))]
>                 for string in substrings:
>                     if string not in prunedK:
>                         prunedNew.remove(s)
>                         continue
>                     continue
> 
> The error is:
> prunedNew.remove(s)
> ValueError: list.remove(x): x not in list

the ValueError means exactly what it says -- have you verified that the 
value of "s" really is present in the list?  did you really mean to 
remove "s" and not, say, "string" ?

</F>




More information about the Python-list mailing list