応答がないことから、これに対するきちんとしたクリーンな解決策がないことを推測しています。これが私がやったことです:
このようにユーティリティを作成しました:
class Pybot_Utilities:
def sublistReplace(self, processList, item, SublistIndex, ItemIndex):
'''
Replaces an item in a sublist
Takes a list, an object, an index to the sublist, and an index to a location in the sublist inserts the object into a sublist of the list at the location specified.
So if the list STUFF is (X, Y, (A,B,C)) and you want to change B to FOO give these parameters: [STUFF, FOO, 2, 1]
'''
SublistIndex=int(SublistIndex)
ItemIndex=int(ItemIndex)
processList[SublistIndex][ItemIndex] = str(item)
return processList
次に、このエントリをロボット フレームワーク テスト スイート ファイルに追加します。
| | ${ListWithSublist} = | sublistReplace | ${ListWithSublist]} | NewItem | 1 | 1 |
(もちろん、私のユーティリティライブラリをインポートしています)
これが実行された後、リストのインデックス 1 にあるサブリストの 2 番目の項目 (インデックス 1) は「NewItem」になります。
おそらく最もエレガントでも柔軟でもありませんが、今のところはうまくいきます