I'm trying to print lines from a text file to look like this format:
"line one",
"line two",
"line three",
I'm using this code
file1 = open('notes.txt', 'r')
lines = file1.readlines()
for line in lines:
print('"'+line+'",')
but it ends up looking like this instead:
"line one
",
"line two
",
"line three",
Is there a way so that it isn't just the last line that has its closing quotation mark on the same line? I'm using print
to format instead of printing the lines directly because I want the double quotation marks per item per line.