I have a text file(new.txt) which has data like:
{
"String1": {
"Value1": {"One":"a","Two":"b","Three":"c"},
"Value2": {"One":"aa","Two":"bb","Three":"cc"},
}
"String2": {
"Value1": {"One":"a1","Two":"b1","Three":"c1"},
"Value2": {"One":"aa1","Two":"bb1","Three":"cc1"},
}
}
I want to display the value of: String1,value1 that is {"One":"a","Two":"b","Three":"c"} String2,value2 and One that is "aa1"
How can i display it..
import ast
with open('new.txt') as f:
d = ast.literal_eval(f.read())
print d['String2']['Value2']['One']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With