I have received an output , it likes this.
{
orange: '2',
apple: '1',
lemon: '3'
}
I know it is not a standard JSON format, but is it still possible to parse into Python Dictionary type? Is it a must that orange , apple , lemon must be quoted?
Thanks you
This is valid YAML (a superset of JSON). Use PyYAML to parse it:
More, since there is a tab space inside the string s, we better remove it before parsing into yaml.
Otherwise, the above string cannot be parsed.