Reposted from: https://www.cnblogs.com/vercont/p/10210233.html
Call the code like this in python2.7
open('file/name.txt','r',encoding= 'utf-8').read()
Will appear
TypeError: 'encoding' is an invalid keyword argument for this function
such mistakes
The code needs to be modified to
import io
io.open('file/name.txt','r',encoding= 'utf-8').read()