csv文件数据展示:
使用python来读取数据:
示例代码1:
import csv
with open('体检表.csv', 'r', encoding='utf-8') as csv_f:
reader = csv.DictReader(csv_f)
for row in reader:
print(row)
运行结果:
示例代码2:
import csv
count = 0
with open('体检表.csv', 'r', encoding='utf-8') as csv_f:
reader = csv.DictReader(csv_f)
for row in reader:
count += 1
# print(row)
print('{"create": {"_index": "info", "_type": "check", "_id": "' + str(count) + '"}}')
print(str(dict(row)).replace("'", '"'))
运行结果:
附录:
序号,姓名,性别,手机号,体检结果
1,刘一,男,15212365423,优秀
2,陈二,男,12345678952,优秀
3,张三,男,13565425865,优秀
4,李四,男,13565425861,优秀
5,王五,男,13565425867,优秀