import re
content = "helloworld"
b = re.findall('w.',content)
print b`
content = "helloworldhelloworld"
b = re.findall('w*',content)
print b
content = "helloworldhelloworldworld"
b = re.findall('he.*ld',content)
print b
content = 'xxhelloworldxxxxhelloworldxx'
b = re.findall('xx.*?xx',content)
print b
content = 'xxhelloworldxxxxhelloworldxx'
b = re.findall('xx(.*?)xx',content)
print b
content = '''xxhelloworld xx'''
b = re.findall('xx(.*?)xx',content)
print b
content = '''xxhelloworld xx'''
b = re.findall('xx(.*?)xx',content,re.S)
print b
content = '''xx123456 xx'''
b = re.findall('(d+)',content,re.S)
print b
import re import requests
f = open('source.txt', 'r')
html = f.read()
f.close()
pattern = '<img src="(.*?)"'
pic_url = re.findall(pattern, html, re.S)
i = 0
for each in pic_url:
print 'Downloading :' + each
pic = requests.get(each)
fp = open('picture\\' + str(i) + '.jpg', 'wb')
fp.write(pic.content)
fp.close()
i = i + 1
C:Python27python.exe E:/PythonCode/20160820/Spider.py Downloading:http://n1.itc.cn/img8/wb/smccloud/fetch/2015/07/04/112732422680200576.JPG Downloading :http://n1.itc.cn/img8/wb/smccloud/fetch/2015/07/04/112640070563900918.JPG Downloading :http://n1.itc.cn/img8/wb/smccloud/fetch/2015/07/04/112547718465744154.JPG Downloading :http://n1.itc.cn/img8/wb/smccloud/fetch/2015/07/04/112455366330382227.JPG Downloading :http://n1.itc.cn/img8/wb/smccloud/fetch/2015/07/04/112363014254719641.JPG Downloading :http://n1.itc.cn/img8/wb/smccloud/fetch/2015/07/04/112270662197888742.JPG Downloading :http://n1.itc.cn/img8/wb/smccloud/fetch/2015/07/04/112178310031994750.JPG Downloading :http://n1.itc.cn/img8/wb/smccloud/fetch/2015/07/04/112085957910403853.JPG Process finished with exit code 0
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有