convert_a_string_to_a_dictionary
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
convert_a_string_to_a_dictionary [2023/02/26 03:15] – raju | convert_a_string_to_a_dictionary [2023/02/26 03:16] – raju | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== Convert a string to a dictionary ===== | ===== Convert a string to a dictionary ===== | ||
+ | ==== ast.literaleval ==== | ||
You can use ast.literaleval from the ast (Abstract Syntax Trees) module. | You can use ast.literaleval from the ast (Abstract Syntax Trees) module. | ||
Line 31: | Line 32: | ||
* https:// | * https:// | ||
+ | ==== json.loads ==== | ||
Another approach is to use json.loads . But its decoder wants double quotes around strings. | Another approach is to use json.loads . But its decoder wants double quotes around strings. | ||
< | < |
convert_a_string_to_a_dictionary.txt · Last modified: 2023/02/26 03:28 by raju