0

I write a list of dics into a csv file. But the output is in one line. How could witer each value in new lines?

    f = open(os.getcwd() + '/friend1.csv','w+',newline='')
    for Member in MemberList:
        f.write(str(Member))
    f.close()
Jizhen F
  • 15
  • 4

1 Answers1

0

Take a look at the writing example in the csv module of the standard library and this question. Either that, or simply append a newline ("\n") after each write: f.write(str(Member)) + "\n").

Community
  • 1
  • 1
Nee
  • 566
  • 2
  • 17