I have string values as,
\"a\" \"a.b\" \"b.c.d\"
How to convert them into python dictionary variables as,
a a[\"b\"] b[\"c\"][\
s = "a.b.c" s = s.replace(".", "][")+"]" # 'a][b][c]' i = s.find("]") # find the first "]" s = s[:i]+s[i+1:] # remove it 'a[b][c]' s = s.replace("]", "\"]").replace("[", "[\"") # add quotations 'a["b"]["c"]' # you can now execute it: v = eval(s)