2013-03-14 2 views
0
arg = urllib2.urlopen(argv[1]).read() 
soup = BeautifulSoup(arg) 
a_tags = soup.find_all('a') #so this stores a list with all the <a href="" /a> tags 

하고 난 단지 (HREF의 기호 번호없이) SAME 페이지에 링크 그렇지 않은 필요제거 <A HREF = "#"태그 파이썬

사람 PLS ....

답변

2

href 속성을 함수로 일치시킬 수 있습니다.

for a in soup.find_all('a', href=lambda value: value.startswith('#')): 
    a.extract()