TypeError: 'encoding' is an invalid keyword argument for this function

时间:2017-11-26 13:26:47   收藏:0   阅读:4384

python 2.7 问题

 data_file = open("F:\\MyPro\\data.yaml", "r", encoding=‘utf-8‘)

  运行的时候报错:TypeError: ‘encoding‘ is an invalid keyword argument for this function
如何解决:
import io
data_file = io.open("F:\\MyPro\\data.yaml", "r", encoding=‘utf-8‘)

  

 

原文:http://www.cnblogs.com/2bjiujiu/p/7898782.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!