Untitled
unknown
plain_text
2 years ago
567 B
13
Indexable
import string
def read():
f = open("gruffalo.txt", "r")
word = ""
while True:
character = f.read(1)
if not character:
break
if character in string.ascii_letters:
word += character
elif character in string.punctuation:
if character == "'":
word += character
else:
print(word)
print(character)
word = ""
else:
print(word)
word = ""
f.close
read()Editor is loading...