Error reporting of Python STR type dictionary conversion

Preface: recently, I crawled a JS file on the Internet and filtered out the final text information. It seems that it is the str type of a dictionary. I used the JSON module of Python to import, that is, the loads function, but an error was reported: valueerror: expected property name: Line 1 column 2 (char 1)

Later, it was found that Jason didn’t support the value of single quotation mark modified attribute

However, the method of converting Python strings to dictionaries is more than just JSON. Loads(), which cleverly uses Python’s built-in function eval() to convert strings into dictionaries

It perfectly solves the disadvantage that Jason’s loads () does not support single quotation marks




Similar Posts: