Re: List objects are un-hashable

2007-04-29 Thread Andy
Thanks Michael and Ant. -- http://mail.python.org/mailman/listinfo/python-list

Re: List objects are un-hashable

2007-04-27 Thread Michael Hoffman
Andy wrote: > Hi, I'm trying to search and print any no# of Python keywords present > in a text file (say - foo.txt), and getting the above error. Sad for > not being able to decipher such a simple problem (I can come up with > other ways - but want to fix this one FFS). It helps a lot of if you p

Re: List objects are un-hashable

2007-04-27 Thread Ganesan Rajagopal
> "Andy" == Andy <[EMAIL PROTECTED]> writes: > if keyword.iskeyword(tempwords): > print tempwords for word in tempwords: if keyword.iskeyword(word): print word Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: List objects are un-hashable

2007-04-27 Thread Ant
> I think it should be: > > if keyword.iskeyword(k): > print k Whoops - yes of course! -- http://mail.python.org/mailman/listinfo/python-list

Re: List objects are un-hashable

2007-04-27 Thread Andy
> What you want is something like: > > for line in inp: > lines +=1 > # a list of words > tempwords = line.split() > for k in tempwords: > if keyword.iskeyword(k): > print tempwords I think it should be: if keyword.iskeyword(k): print k

Re: List objects are un-hashable

2007-04-27 Thread Ant
> for line in inp: > lines +=1 > # a list of words > tempwords = line.split(None) > if keyword.iskeyword(tempwords): > print tempwords You are trying here to ask if a list of words (tempwords) is a keyword. The error is due to the implementation of the iskeyword function wh

Re: List objects are un-hashable

2007-04-27 Thread Alexander Schmolck
Andy <[EMAIL PROTECTED]> writes: > Hi, I'm trying to search and print any no# of Python keywords present > in a text file (say - foo.txt), and getting the above error. Sad for > not being able to decipher such a simple problem (I can come up with Without looking at the docs, it seems save to assu

List objects are un-hashable

2007-04-27 Thread Andy
Hi, I'm trying to search and print any no# of Python keywords present in a text file (say - foo.txt), and getting the above error. Sad for not being able to decipher such a simple problem (I can come up with other ways - but want to fix this one FFS). Any help is appreciated. Thanks!! import keywo