"한계"가 무엇을 의미하는지 설명해주세요.
P粉258788831
2023-08-13 14:47:01
<p><br /></p>
<pre class="brush:py;toolbar:false;">import urllib.request, urllib.parse, urllib.error
컬렉션 가져오기
collections.Callable = collections.abc.Callable
bs4에서 가져오기 BeautifulSoup
SSL 가져오기
# SSL 인증서 오류를 무시합니다
ctx = ssl.create_default_context()
ctx.check_hostname = 거짓
ctx.verify_mode = ssl.CERT_NONE
url = input('URL을 입력하세요:')
count = input('입력 개수: ')
position = input('입력 위치: ')
print('가져오기:', url)
i가 범위(0,int(count))에 있는 경우:
html = urllib.request.urlopen(url, context=ctx).read()
수프 = BeautifulSoup(html, 'html.parser')
# 태그 가져오기
태그 = 수프('a',limit=int(위치))
태그 내 태그의 경우:
url = tag.get('href',없음)
print('Getting:', tag.get('href',None))
</pre>
<p>이 코드에서 <code>limit</code> 기능이 무엇인지 설명해 주세요. </p>
<p>한도를 삭제한 후 전혀 다른 결과가 나왔습니다. </p>
@boris-verkhovskiy님 말씀이 맞습니다. 문서에 따르면: "뷰티풀수프에게 특정 수의 결과가 발견되면 수집을 중단하라고 알려줍니다."