My code:
import csv
# Create a list of Gujarati strings
strings = [['હેલો, વર્લ્ડ!', 'સુપ્રભાત', 'મારા નામ હેઠળ છે']]
# Open the CSV file in 'w' mode
with open('Gujarati.csv', 'w', encoding='utf-16',newline='') as f:
# Create a CSV writer
writer = csv.writer(f)
# Write the strings to the CSV file
writer.writerows(strings)
I am trying to write each heading as a different column, but I don't know why it is getting in the same column. I want it to be in separate columns. I don't know what else to write but feel free to ask me anything anytime.
I appreciate any help you can provide
CodePudding user response:
Import or export text (.txt or .csv) files You can change the separator character used in both delimited and .csv text files. This may be necessary to ensure that the import or export operation works the way you want it to.