top

Python 表格文件操作

废话不多说看代码:

import csv
if __name__ == '__main__':
with open('devs.csv', mode='r', encoding='utf8') as f:
items = csv.DictReader(f)
# 可以通过delimiter指定分隔符,常见的是逗号和制表符,默认是逗号
# f_csv = csv.DictReader(f, delimiter='\t')
for item in items:
print(item)
import csv if __name__ == '__main__': with open('devs.csv', mode='r', encoding='utf8') as f: items = csv.DictReader(f) # 可以通过delimiter指定分隔符,常见的是逗号和制表符,默认是逗号 # f_csv = csv.DictReader(f, delimiter='\t') for item in items: print(item)>
THE END
icon
分享
icon
二维码
发表评论
评论列表

赶快来坐沙发