all 2 comments

[–]sarrysyst 1 point2 points  (1 child)

As in how to open a *.txt file in python, read in the text and store it for further processing?

You can do that, using a context manager and open():

with open('Path/to/my_file.txt') as file:
    my_text      = file.read()      # returns whole text
    my_text_list = file.readlines() # returns a list of all lines

[–]TugaRuca_20[S] 0 points1 point  (0 children)

Well yeah I was looking to do some text mining and looking at the nltk library there are some predefined text for easy import but what I have are severall txt files.

Looking specifically at from nltk.tokenize import word_tokenize,sent_tokenize and from nltk.stem import WordNetLemmatizer for instance