python re.findall(rule,data),根据左右边界取值url中参数的值
import re '''
取值postid,左边界"postid=",右边界"&"
'''
url="http://wwww.baidu.com/aspx?postid=6232&actiontip='保存成功'"
postid=re.findall(r"postid=(.*?)&",url)[0]
print(postid)
def findall_data(data,LB="",RB=""):
rule=LB + r"(.+?)" + RB
datalist=re.findall(rule,data)
return datalist
data1=findall_data(url,"postid=",'&')[0]
print(data1)
python re.findall(rule,data),根据左右边界取值url中参数的值的更多相关文章
- [Python爬虫] 之十一:Selenium +phantomjs抓取活动行中会议活动信息
一.介绍 本例子用Selenium +phantomjs爬取活动行(http://www.huodongxing.com/search?qs=数字&city=全国&pi=1)的资讯信息 ...
- [Python爬虫] 之十:Selenium +phantomjs抓取活动行中会议活动
一.介绍 本例子用Selenium +phantomjs爬取活动树(http://www.huodongshu.com/html/find_search.html?search_keyword=数字) ...
- [Python爬虫] 之九:Selenium +phantomjs抓取活动行中会议活动(单线程抓取)
思路是这样的,给一系列关键字:互联网电视:智能电视:数字:影音:家庭娱乐:节目:视听:版权:数据等.在活动行网站搜索页(http://www.huodongxing.com/search?city=% ...
- 【Python】如何取到input中的value值?
练习:取到下方链接下所有海贼王的下载链接. # coding=utf-8 from selenium import webdriver from time import sleep import ke ...
- Python Web-第二周-正则表达式(Using Python to Access Web Data)
0.课程地址与说明 1.课程地址:https://www.coursera.org/learn/python-network-data/home/welcome 2.课程全名:Using Python ...
- 【Python学习笔记】Coursera课程《Using Python to Access Web Data 》 密歇根大学 Charles Severance——Week2 Regular Expressions课堂笔记
Coursera课程<Using Python to Access Web Data > 密歇根大学 Charles Severance Week2 Regular Expressions ...
- 《Using Python to Access Web Data》 Week5 Web Services and XML 课堂笔记
Coursera课程<Using Python to Access Web Data> 密歇根大学 Week5 Web Services and XML 13.1 Data on the ...
- 《Using Python to Access Web Data》Week4 Programs that Surf the Web 课堂笔记
Coursera课程<Using Python to Access Web Data> 密歇根大学 Week4 Programs that Surf the Web 12.3 Unicod ...
- Python Tutorial 学习(五)--Data Structures
5. Data Structures 这一章来说说Python的数据结构 5.1. More on Lists 之前的文字里面简单的介绍了一些基本的东西,其中就涉及到了list的一点点的使用.当然,它 ...
随机推荐
- 第二章(1.3)Python基础知识(输入输出)
一.?输出 用print加上字符串,就可以向屏幕上输出指定的文字 print?'hello, world' print也可以打印整数. >>> print?300 二.?输入 Pyt ...
- 【SpringBoot】SpringBoot的基础,全面理解bean的生命周期
前言 前段时间直接上手使用springboot开发了一个数据平台的后台部分,但是自身对于springboot的原理和过程还不是很清晰,所以反过来学习下springboot的基础. 大家都知道sprin ...
- ubuntu snap 包管理器
基本使用 snap find $package snap install $package [--channel=beta] snap list snap refresh $package [--ch ...
- 在controller的action内, 得到用户发过来的请求地址和参数url
class PController extends Controller{ public function Log() { echo $_SERVER["HTTP_HOST"] . ...
- 【翻译自mos文章】oraclepassword管理策略
oraclepassword管理策略 參考原文: Oracle Password Management Policy (Doc ID 114930.1) 细节: password管理通过使用profi ...
- fieldset与legend,label
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Java面试宝典(7)混合2
数据库 & XML & 流行的框架与新技术 & 软件工程与设计模式 & J2EE & EBJ & webservice & 其他 pageSiz ...
- ReactOS 无法显示中文的问题
其实非常简单, 实际上是因为包里面没有中文字体,所以输出文字都是乱码, 去 https://svn.reactos.org/optional/ 这里,下载ttf字体文件, 把字体文件放到源码中 mod ...
- SQL数据库—<2>数据库基本操作(CRUD)
学习基本操作语句之前先简单了解数据库的基本数据类型: 数据类型: 二进制数据:以十六进制形式存储 固定长度:binary 可变长度:varbinary 字符数据 ...
- 第八组Postmortem事后分析
第八组Postmortem事后分析 一.团队成员总结的改进和教训 隆晋威:Beta阶段完善架构设计,分工更加明确,文档更丰富,交流带来开销减少.Alpha技术选型不固定,分工混乱,没有方便的测试引擎, ...