1

I am trying to write hindi to a csv in Python, eg:

import csv
posts = open('test.csv', mode='w', errors='ignore')
post_writer_hindi = csv.writer(posts, delimiter=',', quotechar='\"', quoting=csv.QUOTE_MINIMAL)
post_writer_hindi.writerow(['नमस्ते'])

This results in nothing being actually written. How should this be done?

ZhouW
  • 1,187
  • 3
  • 16
  • 39

1 Answers1

1

open('test.csv', mode='w', errors='ignore') set the encoding to encoding = 'utf-8' so it will be open('test.csv', mode='w', encoding = 'utf-8', errors='ignore')

Axois
  • 1,961
  • 2
  • 11
  • 22