reader

write text file into csv file in python

write text file into csv file in python Question: I’m trying to write a text file into csv file using csv package in python using this code: import csv with open(r’C:Userssoso-DesktopSVMDataSetdrug_list.txt’) as f: with open(‘integrated_x.csv’, ‘w’) as out_file: writer= csv.writer(out_file) for line in f: print(line.strip()) writer.writerow(line.strip()) enter image description here I expected the the file …

Total answers: 1