Skip to main content

system.kanoa.utilities.convertListToDict

Description

Given a list of dictionaries, this function will convert it to a dictionary with the key value being the passed key from the dictionary

Syntax

convertListToDict(dictList, key)
  • Parameters
      dictList (list[dict])
  • Returns
      dictionary
  • Code Example

    # Example Usage:
    dictList = [{'assetName': 'Line 1', 'assetId': 5}, {'assetName': 'Line 2', 'assetId': 6}]
    assetDict = system.kanoa.utilities.convertListToDict(dictList 'assetName')