# How to read and write unicode (UTF-8) files in Python?

PythonServer Side ProgrammingProgramming

The io module is now recommended and is compatible with Python 3's open syntax: The following code is used to read and write to unicode(UTF-8) files in Python

## Example

import io
with io.open(filename,'r',encoding='utf8') as f:
f.write(text)