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)>
阅读剩余
THE END