Python 3 多维字典
📁 词典, python, 错误, 示例, 工作
在学习 python 3.x 的过程中,我完成了基础课程。之前我用 php 写过代码。
现在我决定实现一个计划中的任务:
- 读取 csv 文件
- 在逐行读取文件的过程中,处理这些数据并将其存入数组,构建所需的结构
- ...
这是我的代码
import csvdef gene_name(gene, polfzm, genotype): retu '_'.join([gene, polfzm, genotype]).strip().replace("" "", ""-"")data = {}genes = []with open('example-2.csv', 'r') as file: reader = csv.DictReader(file, delimiter=';') for row in reader: group = row['group'] person_