我的文字示例.txt
文件testing.txt
看起来像这样
city germany
language english
city france
Capital paris
Capital Delhi
现在我想要像这样创建一个字典
{city: germany, fance; language: english ; Capital: paris,Delhi}
我的示例代码是:
${my_dict}= Create Dictionary
#@{keys}= Get Dictionary Keys ${key}
${data} OperatingSystem.Get File
C:\\Users\\cpt2deh\\Desktop\\cmptl\\Sprint19\\Testing\\pythonexercise-lib\\test\\Output2\\Testing.txt
@{lines} Split To Lines ${data}
Remove Values From List ${lines} ${EMPTY}
:FOR ${line} IN @{lines}
\ ${key} ${value} Split String ${line}
#\ Log to console ${key}
#\ Log to console ${value}
\ Run Keyword If '${key}'!= '${empty}' Set To Dictionary ${my_dict} ${key} ${value}
\ Run Keyword If '${value}'!='${empty}' Append To List ${my_dict} ${key} ${value}
\ Set To Dictionary ${my_dict} ${key} ${value}
Log to console ${my_dict}
请帮助我,因为我没有在Array中获取值