Write newline to csv in Python
问题 I want to end each interation of a for loop with writing a new line of content (including newline) to a csv file. I have this: # Set up an output csv file with column headers with open('outfile.csv','w') as f: f.write("title; post") f.write("\n") This does not appear to write an actual \n (newline) the file. Further: # Concatenate into a row to write to the output csv file csv_line = topic_title + ";" + thread_post with open('outfile.csv','w') as outfile: outfile.write(csv_line + "\n") This,