PYTHON   57

python.py

Guest on 10th June 2021 11:05:31 PM

  1. import csv
  2.  
  3.  
  4.  
  5. database = open("input.txt")
  6.  
  7.  
  8. for record in csv.reader(database):
  9.     firstname = record[0]
  10.     lastname = record[1]
  11.     string = ("\n" + firstname + "," + lastname)
  12.  
  13.     myfile = open("database.txt", "a")
  14.     myfile.write(string)
  15.     myfile.close()
  16. database.close()

Raw Paste


Login or Register to edit or fork this paste. It's free.