How to pass dictionary(hash value) as command line argument to python script?

Here I m passing dictionary as command line argument to python script

python {“doctype”:“Address”,“address_title”:“Mr.Machha”,“address_line1”:“Vijayanagar”,“city”:“BangLORE”,“phone”:“012345678”}

And in my python script( I m getting

data= sys.argv[1]

print data

Here I m not getting dictionary as I m passing ie


How to get dictionary as mentioned above in my script?

Hi, through the command line you can not pass python objects like dictionaries,lists,… Of course you can try some thing like this by importing json module :

import json


Reference :

And one more thing, you can ask these type of questions in instead of codechef

print data

{‘city’: ‘BangLORE’, ‘address_line1’: ‘Vijayanagar’, ‘doctype’: ‘Address’, ‘address_title’: ‘Mr.Machha’, ‘phone’: ‘012345678’}

if your new in python means, you will get overall idea about python

Thank You for your link.

I already tried that link but I m not getting out put as I want ie {“doctype”:“Address”,“address_title”:“Mr.Machha”,“address_line1”:“Vijayanagar”,“city”:“BangLORE”,“phone”:“012345678”}
that’s why i asked this question in codechef.
I m new to python so your help will be appreciated.