string split

Laura Creighton lac at strakt.com
Mon Dec 9 17:43:06 EST 2002


> 
> Hello,
> 
>              I had a question with split function in strings:
> 
> My string is:
> 
> Requirement: O111
> |
> 
> 
> where I would like to split the string into a list of two tokens: 'Requirem
ent: O111' and '|'
> 
> Hence my code is as follows:
> 
> name = string.split(nametrace,'\n')
> 
> But I get an exception saying 
> 
> 'TypeError: list objects are unhashable'
> 
> What is my mistake in the above code?
> 
> Thank you.

Post more code and paste in the error message.  This code is great ...
so your problem is that what you think you have isn't what is there.
My guess would be that your lines are not terminated with \n, but
that is just a guess ...

Laura Creighton




More information about the Python-list mailing list