返回顶部

Python3 -- CSV读取文件

直接上代码:

# coding: utf-8

import csv

csvfile = file('csv_test.csv', 'rb')
reader = csv.reader(csvfile)

for line in reader:
    print line

csvfile.close() 
import csv

with open(filepath, 'r', encoding='utf8') as f:
    reader = csv.reader(f)
    
    for item in reader:
    # item 每行的数据(列表格式[1, 2, 3, 4])
print(item)

 

posted @ 2020-04-25 10:54  Be-myself  阅读(616)  评论(0编辑  收藏  举报
levels of contents 点击查看具体代码内容