regex - Python parse javascript for variable name and it's value -


i'm trying parse javascript tag has variable named options. value of options array,

"options: [[], []]" 

how can return options list?

currently i'm using beautifulsoup having trouble finding text , how search convert data after options python list

there other text surrounding variable , it's value

json.loads(re.search("options: (.*)","adsasd\noptions: [[],[]]\nqqt").group(1)) 

is 1 way guess... not way dont think ... think missing alot of details in order provide useful answer

althoug suspect data looks more this

""" {    key1:'value1',    options: [[],[]],    other:'somve other value' } """ 

in case can do

data = yaml.load(my_input_text) print data['options'] 

(see below)

>>> data = yaml.load("""{   key1: 'value1',   options: [[],[]],   other: 'somve other value'}""") >>> data {'key1': 'value1', 'other': 'somve other value', 'options': [[], []]} >>> data['options'] [[], []] >>> 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -