A Text object contains text from a txt file.
filename = pickAFile()
text = Text(filename)
print(text.getWords())
Parameters: | filename (string) – the name of the text file. |
---|
filename = pickAFile()
text = Text(filename)
Print all words in the text whose length is less than three.
text.printSmallWords()
Return a list of the words in the text.
# Loop through the words, printing each one.
for word in text.getWords():
print(word)
Return a list of the lines in the text.
# Loop through the text's lines, printing each one.
for line in text.getLines():
print(line)