Re: accessing a text file

2010-09-05 Thread Seth Rees
On 09/05/10 16:47, Baba wrote: > level: beginner > > how can i access the contents of a text file in Python? > > i would like to compare a string (word) with the content of a text > file (word_list). i want to see if word is in word_list. let's assume > the TXT file is stored in the same director

Re: Performance: sets vs dicts.

2010-08-29 Thread Seth Rees
On 08/29/10 14:43, Peter Otten wrote: John Nagle wrote: Is the "in" test faster for a dict or a set? Is "frozenset" faster than "set"? Use case is for things like applying "in" on a list of 500 or so words while checking a large body of text. As Arnaud suspects: no significant differenc