python 2.7版本
data_file = open("data.txt", "r", encoding='utf-8')
运行的时候报错:
TypeError: 'encoding' is an invalid keyword argument for this function
解决:
import io data_file = io.open("data.txt", "r", encoding='utf-8')
python 2.7版本
data_file = open("data.txt", "r", encoding='utf-8')
运行的时候报错:
TypeError: 'encoding' is an invalid keyword argument for this function
解决:
import io data_file = io.open("data.txt", "r", encoding='utf-8')