data = opener.open(url)
data=data.read().decode('utf-8')
data=dict(data)
报错如下
ValueError: dictionary update sequence element #0 has length 1; 2 is required
使用python 内置函数eval
将字符串转为字典
eval(expression[, globals[, locals]])
data = opener.open(url)
data=data.read().decode('utf-8')
data=eval(data)