python: separate lines including the period or excalamtion mark and print it to the prompt..
47
python: separate lines including the period or excalamtion mark and print it to the prompt.. -
with open("file.txt") as f:
out = []
for line in f:
for word in line.split():
out.append(word)
if word.endswith(('.', '!')):
print(' '.join(out)+'\n')
out.clear()