找回密码
 加入
搜索
查看: 5319|回复: 15

[IE类操作] 【已解决】请教一下如何不用正则获取11跟℃

[复制链接]
发表于 2017-4-27 08:35:50 | 显示全部楼层 |阅读模式
本帖最后由 black丶shark 于 2017-5-2 16:01 编辑

<div class="weather-two">
<div class="weather-wd" id="wd">11</div>
<div class="weather-wd-top">℃</div>
</div>
发表于 2017-4-27 09:04:20 | 显示全部楼层
发表于 2017-4-27 09:15:10 | 显示全部楼层
(?:">)([^<]+)</
发表于 2017-4-27 10:25:11 | 显示全部楼层
回复 3# lpxx


    秘书,看好标题,是不用正则。
发表于 2017-4-27 11:41:16 | 显示全部楼层
$a = stringsplit (原始数据,'<div class="weather-wd" id="wd">',1)
$b = stringsplit ($a[2],'</div>',1)
发表于 2017-4-27 11:42:08 | 显示全部楼层
_StringBetween(原始数据,'<div class="weather-wd" id="wd">','</div>')
 楼主| 发表于 2017-4-27 13:49:48 | 显示全部楼层
回复 6# fenhanxue


    你好,请问一下这个原始数据是?
发表于 2017-4-27 13:58:10 | 显示全部楼层
回复 7# black丶shark


    原始数据 = 你要处理的数据
即:

<div class="weather-two">
<div class="weather-wd" id="wd">11</div>
<div class="weather-wd-top">℃</div>
</div>
 楼主| 发表于 2017-4-27 14:14:37 | 显示全部楼层
回复 8# fenhanxue

这样么?我忘记说了,这个11是动态的


  $a = stringsplit ("11",'<div class="weather-wd" id="wd">',1)
   $b = stringsplit ($a[2],'</div>',1)
   _StringBetween("℃",'<div class="weather-wd" id="wd">','</div>')
   MsgBox(0,"",$a)
发表于 2017-4-27 14:29:45 | 显示全部楼层
#Include <String.au3>


$a = '<div class="weather-two">' & @CRLF & _
'<div class="weather-wd" id="wd">11</div>'&@CRLF & _
'<div class="weather-wd-top">℃</div>'&@CRLF & _
'</div>'


$b = _StringBetween($a,'<div class="weather-wd" id="wd">','</div>')
MsgBox(0,'你要的结果',$b[0])
 楼主| 发表于 2017-4-27 14:39:26 | 显示全部楼层
回复 10# fenhanxue


    这个11从网页上获取的是动态的怎么办呢?
发表于 2017-4-27 22:08:51 | 显示全部楼层
回复 4# haijie1223

秘书。。。
 楼主| 发表于 2017-4-28 10:26:08 | 显示全部楼层
回复 12# lpxx


    大神,正则的话这样写对么?

Local $data = _INetGetSource("http://m.weather.com.cn/mweather/101070101.shtml")
Local $shishi = StringRegExp($data,'(?:\">)([^<]+)</',1)
MsgBox(0,0,$shishi[0])
发表于 2017-4-28 13:49:32 | 显示全部楼层
本帖最后由 lpxx 于 2017-4-28 13:52 编辑

回复 13# black丶shark
#include <INet.au3>
#Include <Array.au3>
Local $data =BinaryToString(_INetGetSource("http://m.weather.com.cn/mweather/101070101.shtml",False),4)
Local $shishi = StringRegExp($data,'<span>([^<]+)',3)
;~ Local $shishi = StringRegExp($data,'(?:<span>|<b>)([^<]+)',3)
_ArrayDisplay($shishi)
MsgBox(0,0,$shishi[0])
发表于 2017-4-28 16:06:58 | 显示全部楼层
网页内容发全了。
他要用  htmlfile
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-3-29 20:20 , Processed in 0.087222 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表