I have string in Python from which I want to extract some information. It almost has the format of a list as you can see.
Is there an easy way to convert this into a list? As you can tell I am new to Python and regular expressions
I am after the data in "values" (3 arrays) and the corresponding labels
就像是
ast.literal_eval(re.search("data:(.*)",text_content).groups()[0])
This is javascript, so best try with json decoding. When this is the only text you want to decode or you always have only once the text "values":
, you can use
import json
mark = '"values":'
lists = json.JSONDecoder().raw_decode(text, text.index(mark)+len(mark))[0]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.