Write a program in Python 3 that searches a text file for a line that starts with
Question:
Write a program in Python 3 that searches a text file for a line that starts with 'text:' and then stores everything between the two quotes to a list[], while adding a period '.' to the end of each line. The result should be printed into an output program. There may be multiple 'text:' blocks in an input file, this program must find them all and print all the information stored within them!
DONT USE "START_COPYING" ANOTHER CHEGG ANSWER USED THAT!
Hints-
1. Try using line.startswith() to find the line within the input file! Don't forget to strip the 'text:' while keeping the quotes!
2. You can use the quotes to signify the start and end of the text you want to store
input:
random: dont copy this
text: "
this is the sample text
it needs to be copied
including the quotes
}
"
x: "useless text"
output:
"
this is the sample text.
it needs to be copied.
including the quotes.
}
"
Fundamentals of Cost Accounting
ISBN: 978-0077398194
3rd Edition
Authors: William Lanen, Shannon Anderson, Michael Maher