我有一个Excel文件,其中每个单元格都有一个标题及其值(int、string或nothing),用:
符号分隔。我想做一本字典,其中一个键可以是一个标题。你知道吗
excel文件中的列如下所示:
Procedure: PicProc #cell 1
Mod: avB #cell 2
ImageFile: av.jpg #so on
Odor: 1
OlfClass: 1
Jitter: 9500
ScaleDur: 4500
OdorList.Cycle: 1
OdorList.Sample: 10
Running: OdorList
FixationBlack.OnsetDelay: 2893
FixationBlack.OnsetTime: 217369
FixationBlack.RESP:
FixationBlack1.OnsetDelay: 27
FixationBlack1.OnsetTime: 226896
FixationBlack1.RESP:
FixationYellow.RESP:
PicPresent.OnsetDelay: 34
PicPresent.OnsetTime: 227547
PicPresent.RESP:
RatingOnset: 230558
我想要这样的东西:
{'Procedure': 'PicProc','Mod': 'avB', 'ImageFile': 'av.jpg','Odor': '1'... }
我该怎么做?你知道吗
您可以使用此代码访问excel并获取值 正如您在图像中看到的,您可以获得标题的第一行 所以你会有:区域;Sotto-area1等等 并获取第二行、第三行等等的值。 结果你会 Area=“Campalto”;Sotto-area1=“”等
假设您的数据放在工作簿的第一页,在
column A
内,您可以这样提取数据:输出
希望有帮助。你知道吗
相关问题 更多 >
编程相关推荐