【发布时间】:2017-05-25 21:38:26
【问题描述】:
我有一个包含内容的文件example.csv
1,"A towel,",1.0
42," it says, ",2.0
1337,is about the most ,-1
0,massively useful thing ,123
-2,an interstellar hitchhiker can have.,3
如何使用 Python 阅读 example.csv?
同样,如果我有
data = [(1, "A towel,", 1.0),
(42, " it says, ", 2.0),
(1337, "is about the most ", -1),
(0, "massively useful thing ", 123),
(-2, "an interstellar hitchhiker can have.", 3)]
如何使用 Python 将data 写入 CSV 文件?
【问题讨论】:
-
这是一个canonical question,因为我刚刚发现很多重复的问题以不同的方式构建问题,但本质上是这个问题。
-
骗子的例子:stackoverflow.com/questions/5788521/…stackoverflow.com/questions/26903304/…stackoverflow.com/questions/1593318/…stackoverflow.com/questions/24662571/python-import-csv-to-liststackoverflow.com/questions/34568774/…stackoverflow.com/questions/14725020/read-csv-file-from-pythonstackoverflow.com/questions/16283799/…...
-
当您在 Google 上搜索“python read csv stackoverflow”时会出现更多重复项