Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)+'
')
                out.clear()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #separate #lines #including #period #excalamtion #mark #print
ADD COMMENT
Topic
Name
7+5 =