By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,041 Members | 1,734 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,041 IT Pros & Developers. It's quick & easy.

How to use bash array in python dictionary

P: 1
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<${#errorMessage[@]}+1; i++ )):
dict4["Message $i"]="${errorMessage[$i-1]}"

so the dictionary values should look like:
Message 1 = "this is message 1",
Message 2 = "this is message 2",
etc.
May 25 '18 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.