It’s very simple for Python 3.x (docs).
import csv
with open('output_file_name', 'w', newline="", encoding='utf-8') as csv_file:
writer = csv.writer(csv_file, delimiter=";")
writer.writerow('my_utf8_string')
For Python 2.x, look here.
More Related Contents:
- ‘utf-8’ codec can’t decode byte 0xa0 in position 4276: invalid start byte
- Python 3 CSV file giving UnicodeDecodeError: ‘utf-8’ codec can’t decode byte error when I print
- Changing default encoding of Python?
- Why should we NOT use sys.setdefaultencoding(“utf-8”) in a py script?
- Working with UTF-8 encoding in Python source [duplicate]
- Reading a UTF8 CSV file with Python
- Url decode UTF-8 in Python
- How to convert a file to utf-8 in Python?
- Dangers of sys.setdefaultencoding(‘utf-8’)
- How do I check if a string is unicode or ascii?
- General Unicode/UTF-8 support for csv files in Python 2.6
- How to print UTF-8 encoded text to the console in Python < 3?
- Why doesn’t Python recognize my utf-8 encoded source file?
- Why declare unicode by string in python?
- Should I use encoding declaration in Python 3?
- Python ascii utf unicode
- Loading UTF-8 file in Python 3 using numpy.genfromtxt
- Python DictWriter writing UTF-8 encoded CSV files
- ElementTree and unicode
- UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc3 in position 23: ordinal not in range(128)
- Why does this Python program send empty emails when I encode it with utf-8? [duplicate]
- Changing the “locale preferred encoding” in Python 3 in Windows
- Convert “\x” escaped string into readable string in python
- python encoding utf-8
- Python – dealing with mixed-encoding files
- UnicodeDecodeError when performing os.walk
- Pandas df.to_csv(“file.csv” encode=”utf-8″) still gives trash characters for minus sign
- u’\ufeff’ in Python string
- How to do row-to-column transposition of data in csv table?
- Row count in a csv file