在下面的代碼中,符號字符串re.sub('<[^>]*>|[\n]|\[[0-9]*\]', '', htmlread)
的每個元素是什麼意思?Python網頁抓取,符號含義
import urllib2
import re
htmltext = urllib2.urlopen("https://en.wikipedia.org/wiki/Linkin_Park")
htmlread = htmltext.read()
htmlread = re.sub('<[^>]*>|[\n]|\[[0-9]*\]', '', htmlread)
regex = '(?<=Linkin Park was founded)(.*)(?=the following year.)'
pattern = re.compile(regex)
htmlread = re.findall(pattern, htmlread)
print "Linkin Park was founded" + htmlread[0] + "the following year."
http://stackoverflow.com/questions/22937618/參考 - 什麼 - 做 - 這正則表達式均值 –