def addl(match):
val=match.group()
num=int(val)+1
reutrn str(num)
SyntaxError: invalid syntax
不能转换字符串
val=match.group()
num=int(val)+1
reutrn str(num)
SyntaxError: invalid syntax
不能转换字符串
2017-10-13
Python 3.6 代码:
import re
import requests
i = 0
res = requests.get('http://www.imooc.com/search/course?words=python').text
urllist = re.findall(r'http://.+\.jpg',res)
for url in urllist:
f = open(str(i)+'.jpg','wb')
req = requests.get(url).content
f.write(req)
f.close()
i+=1
import re
import requests
i = 0
res = requests.get('http://www.imooc.com/search/course?words=python').text
urllist = re.findall(r'http://.+\.jpg',res)
for url in urllist:
f = open(str(i)+'.jpg','wb')
req = requests.get(url).content
f.write(req)
f.close()
i+=1
2017-10-09
给大家一个简单的例子
print re.match(r'(a)(b)(c)\1\2\3','abcabc').group()
print re.match(r'(a)(b)(c)\1\2\3','abcabc').group()
2017-10-03