JIMaz 发表于 2020-5-22 18:31

对上一篇正则求助帖的一些说明

上一篇我给的数据不是很明了,只给了一部分源码,这是爬取的网页内容
{
        'parameter':{
       'dse_applicationId':'-1',
       'dse_sessionId':'HOAIBFEABVJPHZIOGVFCFYBWAAFFJVEJEADDCRDX',
       'balancingParam':'name="dse_sessionId" value="HOAIBFEABVJPHZIOGVFCFYBWAAFFJVEJEADDCRDX"',
       'dse_pageId':'1',
       'wapVersion':'3'
},

        'opdata':{
                'jsonData':{"buyIncome_sallStatue":"exist","line_datalist":[{"type_name":"人民币账户黄金","in_data":"397.70","_action":"form=acctGold@gold_proid=130060000043@gold_proName=人民币账户黄金","num_status":"222","out_data":"398.60"},{"type_name":"人民币账户白银","in_data":"3.897","_action":"form=acctGold@gold_proid=130060000044@gold_proName=人民币账户白银","num_status":"221","out_data":"3.927"},{"type_name":"人民币账户铂金","in_data":"189.83","_action":"form=acctGold@gold_proid=130060000041@gold_proName=人民币账户铂金","num_status":"221","out_data":"192.95"},{"type_name":"人民币账户钯金","in_data":"446.58","_action":"form=acctGold@gold_proid=130060000123@gold_proName=人民币账户钯金","num_status":"221","out_data":"464.71"},{"type_name":"美元账户黄金","in_data":"1733.7650","_action":"form=acctGold@gold_proid=130060000045@gold_proName=美元账户黄金","num_status":"222","out_data":"1737.0050"},{"type_name":"美元账户白银","in_data":"16.9780","_action":"form=acctGold@gold_proid=130060000046@gold_proName=美元账户白银","num_status":"222","out_data":"17.1280"},{"type_name":"美元账户铂金","in_data":"826.6430","_action":"form=acctGold@gold_proid=130060000042@gold_proName=美元账户铂金","num_status":"222","out_data":"841.8370"},{"type_name":"美元账户钯金","in_data":"1945.4879","_action":"form=acctGold@gold_proid=130060000125@gold_proName=美元账户钯金","num_status":"222","out_data":"2026.7529"}],"querytime":"查询时间 18:19:10","object_dataId":"G1","aftersall_buyin":"先卖出后买入","buyin_aftersall":"先买入后卖出","_otherparams":{"detailMkey":"simutrade","mineMkey":"simutrade","tipsMsg":"1、开办账户贵金属交易,须指定本人在工行开立的个人多币种借记卡或结算账户活期存折作为资金账户,并完成开办手续。<br/>2、账户贵金属交易时间一般为周一早7:00到周六早4:00,部分地区交易时间会有不同,详询95588。<br/>3、在行情区,贵金属的交易价格随国际金融行情实时变动,红色代表上涨、绿色代表下跌、黑色代表不变,行情走势图仅供参考,据此交易风险自担。","goldKey":"G1","direction":"1"},"subtitle":{"income":"银行买入价","type":"品种","sellout":"银行卖出价"},"title":{"stick":"置顶","lump_title":"","i_status":"201","refresh":"刷新","lump_tit":"账户贵金属"},"subname":{"transtion_status":"exit","subname_status":"onlyAll","positions_status":"exit","positions":"我的持仓","transtion":"交易明细"},"errorMessage":"","buySall_clickStatus":"311"},
                'productIds':'130060000043|130060000044|130060000041|130060000123|130060000045|130060000046|130060000042|130060000125'
        }
}
Process finished with exit code 0
我只想取出其中”type_name“下的内容和“in_data”下的和“out_data”下的

葱油拌面 发表于 2020-5-22 19:04

..这数据还是json格式的啊,还是解析就可以拿到了

assdqwe123 发表于 2020-5-22 19:05

{"type_name":"(.*?)","in_data":"(.*?)",.*?out_data":"(.*?)"}
楼主可以试试

JIMaz 发表于 2020-5-22 19:40

assdqwe123 发表于 2020-5-22 19:05
{"type_name":"(.*?)","in_data":"(.*?)",.*?out_data":"(.*?)"}
楼主可以试试

感谢啊,终于出来了{:1_893:}
页: [1]
查看完整版本: 对上一篇正则求助帖的一些说明