比如网址:http://gsxt.lngs.gov.cn/saicp...
里面的内容是:
<script type="text/javascript">
$(document).ready(function(){tzr_paging([{"blicno":"","invid":"1017186481","countryName":"","invtypeName":"自然人股东","sconformName":"1|","respformName":"","dom":"辽宁省铁岭市银州区广裕街7栋2单元601室","blictypeName":"中华人民共和国居民身份证","inv":"张淑坤"},{"blicno":"","invid":"1017186480","countryName":"","invtypeName":"自然人股东","sconformName":"1|","respformName":"","dom":"辽宁省铁岭市银州区广裕街农科巷阳光园六区三期15号楼2单元602室","blictypeName":"中华人民共和国居民身份证","inv":"刘莹雪"}],"2","211202000012015032445494","false");}); </script>
我要获取这个tzr_paging里的内容,除了正则还有别的方法获取这个数组么?
高洛峰2017-04-11 11:49:04
你可以把字典起始部分的字符串抠出来,然后用eval得到这个字典
s = "{'a':1,'b':2}"
d = eval(s)
print d
# than you get dictionary d: {'a': 1, 'b': 2}