我已经获取了一个数据作为列表列表(内部列表由2个值组成,例如(name,sam)),现在我想读取每个内部列表的数据,并添加第一个数据作为key,添加第二个数据作为属性列表的值。例如,((name,sam),(date,fourth),(age,20))=列表列表
转换为=(名称:“sam”,日期:“fourth”,年龄:“二十”)=属性列表
我如何才能做到这一点?
set excelRead to WorkBook(ResourcePath(fileName))
set readColumns to excelRead.Worksheet(sheetName)
set listOfData to cellRange("A:B") of readColumns
put (:) into newPlist
repeat with each item of listOfData
put item 1 of it into key
put item 2 of it into Value
end repeat发布于 2020-01-14 18:26:48
您只需将变量名括起来,即可将其用作属性列表中的键:
put Value into newPlist.(key)
put Value into (key) of newPlist
put Value into newPlist's (key)它在这里的SenseTalk引用中:Referencing Property List Keys Using Variables
https://stackoverflow.com/questions/55392596
复制相似问题