I am writing the content of "article" to a text file.
Source file:
lol hi
lol hello
lol text
lol test
Python:
for line in all_lines:
if line.startswith('lol '):
mystring = line.replace('lol ', '').lower().rstrip()
article = 'this is my saved file\n' + mystring + '\nthe end'
This is what gets saved to the txt file:
this is my saved file
test
the end
This is what I want saved to the txt file:
this is the saved file
hi
hello
test
text
the end