How to use bash array in python dictionary

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • akunde
    New Member
    • May 2018
    • 1

    How to use bash array in python dictionary

    I have an array in bash which consists of string messages.
    errorMessage+=( "Message1")
    errorMessage+=( "Message2")

    I need to use these messages as dictionary values in python.
    Something like this:
    for (( i=1; i<${#errorMessa ge[@]}+1; i++ )):
    dict4["Message $i"]="${errorMessag e[$i-1]}"

    so the dictionary values should look like:
    Message 1 = "this is message 1",
    Message 2 = "this is message 2",
    etc.
Working...