所以我有一个数组,其中key:value被记录为单个单位。我想拆分数组,并作为个体记录关键字和值。
示例
array = ["Image loaded:", "RuleName: xx", "UtcTime: xxx", "ProcessGuid: {xxx}", "ProcessId: 884", "Image: C:\\opt\\td-agent\\bin\\ruby.exe", "ImageLoaded: xxx", "FileVersion: -", "Description: -", "Product: -", "Company: -", "OriginalFileName: -", "Hashes: MD5=xxx", "Signed: false", "Signature: -", "SignatureStatus: Unavailable", "User: xx"]
现在,我想循环它并提取key:Value
LOOP THROUGH ARRAY
array[i] = array.split(',',key,value)
print(key)
print(value)
1条答案
按热度按时间jmp7cifd1#
如果您希望构建一个拆分了键和值的新数组,您可以这样做: