string split

Nicodemus nicodemus at globalite.com.br
Mon Dec 9 18:25:13 EST 2002


lily wrote:

> My string is:
>
> Requirement: O111
> |
>
> where I would like to split the string into a list of two tokens: 
> 'Requirement: O111' and '|'
>
> Hence my code is as follows:
>
> name = string.split(nametrace,'\n')
>
> But I get an exception saying
>
> 'TypeError: list objects are unhashable'
>
 >>> nametrace = 'Requirement: O111\n|'
 >>> import string
 >>> name = string.split(nametrace,'\n')
 >>> name
['Requirement: O111', '|']


Works for me... are you sure the string is in this format?


Regards,

Nicodemus.



> ------------------------------------------------------------------------
> Do you Yahoo!?
> Yahoo! Mail Plus 
> <http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com> - 
> Powerful. Affordable. Sign up now 
> <http://rd.yahoo.com/mail/mailsig/*http://mailplus.yahoo.com> 







More information about the Python-list mailing list