I'm trying to process a Korean text file with python, but it fails when I try to encode the file with utf-8.
#!/usr/bin/python
#-*- coding: utf-8 -*-
f = open('tag.txt', 'r', encoding='utf=8')
s = f.readlines()
z = open('tagresult.txt', 'w')
y = z.write(s)
z.close
============================================================= Traceback (most recent call last): File "C:\Users\******\Desktop\tagging.py", line 5, in <module> f = open('tag.txt', 'r', encoding='utf=8') TypeError: 'encoding' is an invalid keyword argument for this function [Finished in 0.1s] ==================================================================
And when I just opens a Korean txt file encoded with utf-8, the fonts are broken like this. What can I do?
\xc1\xc1\xbe\xc6\xc1\xf6\xb4\xc2\n', '\xc1\xc1\xbe\xc6\xc7\xcf\xb0\xc5\xb5\xe7\xbf\xe4\n', '\xc1\xc1\xbe\xc6\xc7\xcf\xbd\xc3\xb4\xc2\n', '\xc1\xcb\xbc\xdb\xc7\xd1\xb5\xa5\xbf\xe4\n', '\xc1\xd6\xb1\xb8\xbf\xe4\