PYTHON读取csv文件
时间: 2023-11-18 19:53:15 浏览: 15
可以使用Python内置的csv模块来读取csv文件。具体步骤如下:
1. 导入csv模块
2. 打开csv文件
3. 创建csv读取器
4. 读取csv文件中的数据
以下是示例代码:
```python
import csv
with open('example.csv', newline='') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
for row in reader:
print(', '.join(row))
```
其中,`example.csv`是要读取的csv文件名,`delimiter`参数指定了分隔符,`quotechar`参数指定了引号字符。