0

Here is my current code:

contentList = ["First line", "Second line", "Third line", "Fourth line", "Fifth line"]

for item in contentList:
    contentList.append("\n")

newFile = open("output2.txt", "w")
newFile.write(cleartext2 + "\n")

In the current code above, I am attempting to go through each element to append a "\n" at the end of each line, then writing a new file called output2.txt and inputting the contentList 's content

Currently, the content of listContent are being imported to output2.txt in one line separated by commas outputted like this:

[First line, Second line, Third line, Fourth line, Fifth line]

My desired output would be:

[First line
Second line
Third line
Fourth line
Fifth line]

Anything would help!

martineau
  • 119,623
  • 25
  • 170
  • 301
bbsmfb
  • 73
  • 6

0 Answers0