Live2D

简单实用的HTML中字符串的提取

html_data="{"code":0,"data":"<table width='583' style='width: 583px; border-collapse: collapse;' border='0' cellspacing='0' cellpadding='0' x:str=''><colgroup><col width='132' style='width: 132px;'/><col width='136' style='width: 136px;'/><col width='71' style='width: 71px;'/><col width='244' style='width: 244px;'/></colgroup><tbody><tr height='33' style='height: 33px;'><td width='583' height='33' style='border: 1px solid windowtext; border-image: none; width: 583px; height: 33px; background-color: transparent;' colspan='4'><p align='center'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑; font-size: 24px;'>商业类标的调查情况表</span></p></td></tr><tr height='45' style='height: 45px;'><td width='132' height='45' style='border-width: 0px 1px 1px; border-style: none solid solid; border-color: black windowtext windowtext; width: 132px; height: 45px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>标的名称</span></td><td width='451' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext black windowtext windowtext; width: 451px; background-color: transparent;' colspan='3'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>中方县生态城同乐路中心市场5栋110号商业用房</span></td></tr><tr height='24' style='height: 24px;'><td width='132' height='70' style='border-width: 0px 1px 1px; border-style: none solid solid; border-color: black windowtext windowtext; width: 132px; height: 70px; background-color: transparent;' rowspan='3'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>权证情况</span></td><td width='136' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>案号</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>(2019)湘1221执272号</span></td></tr><tr height='23' style='height: 23px;'><td width='136' height='23' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 23px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>房产证号</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>中方权证生态城字第712001635号</span></td></tr><tr height='23' style='height: 23px;'><td width='136' height='23' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 23px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>土地产权证</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='23' style='height: 23px;'><td width='132' height='23' style='border-width: 0px 1px 1px; border-style: none solid solid; border-color: black windowtext windowtext; width: 132px; height: 23px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>标的所有人</span></td><td width='451' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 451px; background-color: transparent;' colspan='3'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>杨*</span></td></tr><tr height='24' style='height: 24px;'><td width='132' height='190' style='border-width: 0px 1px 1px; border-style: none solid solid; border-color: black windowtext windowtext; width: 132px; height: 190px; background-color: transparent;' rowspan='8'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>标的现状</span></td><td width='136' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>房屋用途</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>商业</span></td></tr><tr height='24' style='height: 24px;'><td width='136' height='24' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 24px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>土地性质</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='24' style='height: 24px;'><td width='136' height='24' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 24px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>土地用途</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='24' style='height: 24px;'><td width='136' height='24' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 24px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>是否已腾空</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='24' style='height: 24px;'><td width='136' height='24' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 24px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>租赁情况</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>出租</span></td></tr><tr height='24' style='height: 24px;'><td width='136' height='24' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 24px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>过户情况</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='23' style='height: 23px;'><td width='136' height='23' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 23px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>经营情况</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='23' style='height: 23px;'><td width='136' height='23' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 23px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>钥  匙</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='21' style='height: 21px;'><td width='132' height='62' style='border-width: 0px 1px 1px; border-style: none solid solid; border-color: black windowtext windowtext; width: 132px; height: 62px; background-color: transparent;' rowspan='2'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>权利限制情况</span></td><td width='136' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>查封</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>被中方县人民法院查封</span></td></tr><tr height='41' style='height: 41px;'><td width='136' height='41' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 41px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>抵押</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='47' style='height: 47px;'><td width='132' height='433' style='border-width: 0px 1px 1px; border-style: none solid solid; border-color: black windowtext windowtext; width: 132px; height: 433px; background-color: transparent;' rowspan='10'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>标的物介绍</span></td><td width='136' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>建筑面积</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>63.8平方米</span></td></tr><tr height='54' style='height: 54px;'><td width='136' height='54' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 54px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>公摊面积</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='52' style='height: 52px;'><td width='136' height='52' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 52px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>土地总面积</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='42' style='height: 42px;'><td width='136' height='42' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 42px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>房产年龄</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='42' style='height: 42px;'><td width='136' height='42' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 42px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>装修情况</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='42' style='height: 42px;'><td width='136' height='42' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 42px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>房屋户型</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='42' style='height: 42px;'><td width='136' height='42' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: windowtext; width: 136px; height: 42px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>房屋楼层</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext; width: 315px; background-color: transparent;' colspan='2'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>总层数3层,标的位于1层</span></td></tr><tr height='42' style='height: 42px;'><td width='136' height='42' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 136px; height: 42px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>房屋朝向</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext gray; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='35' style='height: 35px;'><td width='136' height='35' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 136px; height: 35px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>周边配套</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext gray; width: 315px; background-color: transparent;' colspan='2'> </td></tr><tr height='35' style='height: 35px;'><td width='136' height='35' style='border-width: 0px 1px 1px 0px; border-style: none solid solid none; border-color: black windowtext windowtext black; width: 136px; height: 35px; background-color: transparent;'><span style='color: rgb(0, 0, 0); font-family: 微软雅黑;'>其他介绍</span></td><td width='315' style='border-width: 1px 1px 1px 0px; border-style: solid solid solid none; border-color: windowtext windowtext windowtext gray; width: 315px; background-color: transparent;' colspan='2'> </td></tr></tbody></table><p></p><br><a href='//img30.360buyimg.com/popWaterMark/jfs/t1/109812/7/6466/73087/5e4cab07Eaf591821/c501be5e3ebf3bee.jpg' target='_blank'><img src ='//img30.360buyimg.com/popWaterMark/jfs/t1/109812/7/6466/73087/5e4cab07Eaf591821/c501be5e3ebf3bee.jpg'/></a><br><br><a href='//img30.360buyimg.com/popWaterMark/jfs/t1/106140/29/12619/108447/5e4cab07E1578473d/8ea7ce4a1d5ed05a.jpg' target='_blank'><img src ='//img30.360buyimg.com/popWaterMark/s1000x750_jfs/t1/106140/29/12619/108447/5e4cab07E1578473d/8ea7ce4a1d5ed05a.jpg'/></a><br><br><a href='//img30.360buyimg.com/popWaterMark/jfs/t1/88239/13/12458/80293/5e4cab07E1b23c1a7/fcdbc15fd8363f1e.jpg' target='_blank'><img src ='//img30.360buyimg.com/popWaterMark/jfs/t1/88239/13/12458/80293/5e4cab07E1b23c1a7/fcdbc15fd8363f1e.jpg'/></a><br><br><a href='//img30.360buyimg.com/popWaterMark/jfs/t1/99602/22/12619/43205/5e4cab07Ed2143a6a/da10dc9b438f93a9.jpg' target='_blank'><img src ='//img30.360buyimg.com/popWaterMark/jfs/t1/99602/22/12619/43205/5e4cab07Ed2143a6a/da10dc9b438f93a9.jpg'/></a><br>","message":"成功","status":0});"

 

 

可以使用:

detail_html = detail_html.split(')')[0:-1]
detail_html = ''.join(detail_html)
detail_html = json.loads(detail_html)
datas = detail_html.get("data")
print(etree.HTML(datas).xpath('string(.)').replace(' ',''))
得到:
商业类标的调查情况表标的名称中方县生态城同乐路中心市场5栋110号商业用房权证情况案号(2019湘1221执272号房产证号中方权证生态城字第712001635号土地产权证 
标的所有人杨*标的现状房屋用途商业土地性质 土地用途 是否已腾空 租赁情况出租过户情况 经营情况 钥  匙 权利限制情况查封被中方县人民法院查封抵押 
标的物介绍建筑面积63.8平方米公摊面积 土地总面积 房产年龄 装修情况 房屋户型 房屋楼层总层数3层,标的位于1层房屋朝向 周边配套 其他介绍
posted @ 2020-02-20 12:11  鸟-叔  阅读(1164)  评论(0编辑  收藏  举报