How to make Python treat literal string as UTF-8 encoded string
Advertisements I have some strings in Python loaded from a file. They look like lists, but are actually strings, for example: example_string = ‘["hello", "there", "w\\u00e5rld"]’ I can easily convert it into an actual list of strings: def string_to_list(string_list:str) -> List[str]: converted = string_list.replace(‘"’, ”).replace(‘[‘, ”).replace(‘]’, ”).split(‘,’) return [s.strip() for s in converted] as_list =… Read More How to make Python treat literal string as UTF-8 encoded string