Home > Software engineering >  Writing in same row in Gujarati in python using CSV writer
Writing in same row in Gujarati in python using CSV writer

Time:01-04

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 provideenter image description here

CodePudding user response:

https://support.microsoft.com/en-us/office/import-or-export-text-txt-or-csv-files-5250ac4c-663c-47ce-937b-339e391393ba#:~:text=You can import data from,to import, and click Import.

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.

  • Related