请问用python怎么把t.html文件里面json格式的数据读出来
比如:<script>varLoan_LoanView={"business_id":"753510","lendersJson":"[348190,457619,100...
比如:
<script>
var Loan_LoanView={"business_id":"753510","lendersJson":"[348190,457619,1001141,1017913,1150545]"}
</script>
怎么把lendersJson里面的数字列表读出来 展开
<script>
var Loan_LoanView={"business_id":"753510","lendersJson":"[348190,457619,1001141,1017913,1150545]"}
</script>
怎么把lendersJson里面的数字列表读出来 展开
1个回答
展开全部
strLoan_LoanView = '''<script>
var Loan_LoanView={"business_id":"753510","lendersJson":"[348190,457619,1001141,1017913,1150545]"}
</script>'''
locJson = strLoan_LoanView.find("lendersJson")
locJsonContent = locJson + len( "lendersJson" )
locJsonListBegin = strLoan_LoanView[ locJsonContent: ].find( "[" ) + locJsonContent
locJsonListEnd = strLoan_LoanView[ locJsonListBegin: ].find( "]" ) + locJsonListBegin
lstRecord = []
lstRecord = strLoan_LoanView[ locJsonListBegin + 1:locJsonListEnd ].split( "," )
大概就是这样的逻辑吧。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询