Q&A

온아이리포에 문의해주세요

  • [파이썬으로 시작하는 데이터 분석] 크롤링 실습

    사진이 안올려져서 텍스트 복사로 올립니다
    beautifulsoup

    # http://www.neweracapkorea.com/shop/shopbrand.html?xcode=031&mcode=002&type=Y&gf_ref=Yz1vU0FlS
    base_url = "http://www.neweracapkorea.com"
    cap_total_url = "/shop/shopbrand.html?xcode=031&mcode=002&type=Y&gf_ref=Yz1vU0F1SM="
    base_url + cap_total_url
    -실행
    "http://www.neweracapkorea.com/shop/shopbrand.html?xcode=031&mcode=002&type=Y&gf_ref=Yz1vU0F1S3
    M='

    #get html
    response = requests.get (base_url+cap_total_url)
    response. status_code
    -실행
    204

    #BeautifulSoup을 활용하여 데이터 파싱
    soup = BeautifulSoup(response.content, "Ixml")
    soup
    -실행
    soup 아무것도 안나옴

    cap_info = soup.findAll( 'div', {"'class": 'tb-center'})
    cap_info[0]
    -실행
    IndexError
    Traceback (most recent call last)
    Cell In[5], line 2
    1 cap_info = soup. findAll( 'div', {"'class": 'tb-center'})
    → 2 cap_info[0]
    IndexError: list index out of range

    작성자. 한정석

    작성일. 2024-06-05

    조회 수. 3234

  • 답변대기