如何从一个.txt中寻找目标字符串?
我有个URL.txt,保存的是已经得到的html源代码,在不用正则表达式的情况下,如何获取里面的URL以及它所对应的名字,然后保存在另外一个.txt 里面?环境是VS2005下
例如得到的源代码:
<html>
...
<body>
...
<a href="http://ss.mop.com/pub/show.php?tpl_id=202&id=296" target="_blank" class="a47">仙魔大战CG</a><br>
<a href="http://ss.mop.com/pub/show.php?tpl_id=202&id=296" target="_blank" class="a47">仙侠异界故事</a><br>
<a href="http://ss.mop.com/pub/show.php?tpl_id=202&id=296" target="_blank" class="a47">五大门派演示</a><br>
<a href="http://ss.mop.com/pub/show.php?tpl_id=202&id=412" target="_blank" class="a47">仙侠异界(序章)</a>
.....
</html>
获取http://ss.mop.com/pub/show.php?tpl_id=202&id=296仙侠异界故事等?
例如得到的源代码:
<html>
...
<body>
...
<a href="http://ss.mop.com/pub/show.php?tpl_id=202&id=296" target="_blank" class="a47">仙魔大战CG</a><br>
<a href="http://ss.mop.com/pub/show.php?tpl_id=202&id=296" target="_blank" class="a47">仙侠异界故事</a><br>
<a href="http://ss.mop.com/pub/show.php?tpl_id=202&id=296" target="_blank" class="a47">五大门派演示</a><br>
<a href="http://ss.mop.com/pub/show.php?tpl_id=202&id=412" target="_blank" class="a47">仙侠异界(序章)</a>
.....
</html>
获取http://ss.mop.com/pub/show.php?tpl_id=202&id=296仙侠异界故事等?
...全文
相关推荐
bm.rar_串 匹配_字符串 匹配_字符串匹配_字符串匹配 c语言_瀛楃涓?鍖归厤
字符串匹配算法,单模式字符串匹配。 使用c语言编写
python在TXT文件中按照某一字符串取出该字符串所在的行方法
主要流程:读取文件数据——将每一行数据分成不同的字符段——在判断 在某个字否段是否含与某个字符。(只是其中一种办法) 代码如下: with open(rC:\Users\LENOVO\Desktop\20170513155231.txt, encoding='utf-8') as f:#从TXT文件中读出数据 for line1 in f: list.append(line1) #通过for循环一行一行加载 datalist=[] #定义一个数组 for item in list: #通过一个for循环将每一行按照空格分成不同的字符段 l = item.split() #这句使
修改txt文档中字符串
自己写的一个小程序,完成txt文件的读取和写入,并对文档进行修改。自定义修改特定位置的内容
python将字符串list写入excel和txt的实例
今天小编就为大家分享一篇python将字符串list写入excel和txt的实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
c语言,怎样输出有空格的字符串?.txt
c语言,怎样输出有空格的字符串?.txt


