Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to add string in csv in python

# Import writer class from csv module
from csv import writer
  
# List 
List=[6,'William',5532,1,'UAE']
  
# Open our existing CSV file in append mode
# Create a file object for this file
with open('event.csv', 'a') as f_object:
  
    # Pass this file object to csv.writer()
    # and get a writer object
    writer_object = writer(f_object)
  
    # Pass the list as an argument into
    # the writerow()
    writer_object.writerow(List)
  
    #Close the file object
    f_object.close()
 
PREVIOUS NEXT
Tagged: #add #string #csv #python
ADD COMMENT
Topic
Name
3+4 =