accessing a text file

MRAB python at mrabarnett.plus.com
Sun Sep 5 18:05:12 EDT 2010


On 05/09/2010 22:47, Baba wrote:
> level: beginner
>
> how can i access the contents of a text file in Python?
>
That's a very basic question.

I suggest you read a tutorial such as "Dive Into Python":

     http://diveintopython.org/toc/index.html

> 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 directory as the PY file.
>
> def is_valid_word(word, word_list)
>



More information about the Python-list mailing list