PYTHON代码摘录

文件处理

#典型的读取文件代码
row_data  = {}
with open('PaceData.csv') as paces:
     column_heading = paces.readline().strip().split(',')
     column_heading.pop(0)
     for each_line in paces:
          row = each_line.strip().split(',')
          row_label = row.pop(0)
          inner_dict = {}
          for i in range(len(column_heading)):
               inner_dict[row[i]] = column_heading[i]
          row_data[row_label] = inner_dict

你可能感兴趣的:(python)