如何导入CSV数据 (python3.6.6区别于python2 环境)

1.python2环境下

 

2.python3.6.6环境下

如果用python2环境下的代码,在python3.6.6环境下编译会出现以下问题:

错误(1):

SyntaxError:Missing parentheses in call to ‘paint’ . Did you mean print(“hello world”);?

错误解析:在调用“paint”时缺少圆括号。 
上面的语法在python3中是错误的。在python3中,你需要将helloworld加括号。

错误(2):

Error: iterator should return strings, not bytes (did you open the file in text mode?)

#问题原因:因为此csv文件并非二进制文件, 只是一个文本文件。

修改代码:

注:参考链接

https://blog.csdn.net/FairyTailQ/article/details/78827056

https://blog.csdn.net/yzf0011/article/details/72903088

 

posted @ 2018-06-21 11:07  小刚的视界  阅读(198)  评论(0编辑  收藏  举报