Skip to content
조회 수 3366 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

네이버 주식의 기업정보와 펀더멘탈정보 소스 가져오기

해당 페이지에서

<div class="cmp_comment"> 요소의 내용을 추출하기 위해서는

BeautifulSoup 라이브러리의

find 또는 find_all 메서드를 사용하여

요소를 찾은 다음,

해당 요소의 내용을 추출할 수 있습니다.

 

아래는 BeautifulSoup

라이브러리를 사용하여

<div class="cmp_comment">

요소의 내용을 추출하는 코드입니다.

 

참고 url = "https://navercomp.wisereport.co.kr/v2/company/c1010001.aspx?cmp_cd=030960"

import requests
from bs4 import BeautifulSoup
 
url = "https://navercomp.wisereport.co.kr/v2/company/c1010001.aspx?cmp_cd=030960"
response = requests.get(url)
html = response.text
soup = BeautifulSoup(html, "html.parser")
 
#기업정보
cmp_comment = soup.find("div", {"class": "cmp_comment"}).text.strip()
print(cmp_comment)
 
#펀더멘탈정보
fund = soup.find("div", class_="fund fl_le").text.strip()
print(fund)

 

 

해당 페이지에서 기업정보에 대한

<div class="cmp_comment">

요소의 내용이 출력됩니다.

 

만약 해당 요소가

페이지에 없는 경우,

None이 반환됩니다.

 

 해당 페이지에서 펀더멘탈 이하 내용에 대한

<div class="fund fl_le">

요소의 내용이 출력됩니다.

strip() 메서드를 사용하여

불필요한 공백과 개행문자를

제거하였습니다.

 

만약 해당 요소가

페이지에 없는 경우,

None이 반환됩니다.

 

 

로그인 후 댓글쓰기가 가능합니다.

?

  1. 03
    Sep 2011
    16:07

    삼성, LG 여! 스마트폰의 창작기술로 아이폰을 점령하라!

    Category컴퓨터잡담 Views3642
    Read More
  2. 16
    Sep 2021
    17:09

    파이썬 웹크롤링 오류 대처방법(verify=False)requests.exceptions.SSLError:

    Category파이썬 Views3638
    Read More
  3. 21
    Feb 2023
    06:32

    파이썬 모듈 업그레이드 명령어

    Category파이썬 Views3628
    Read More
  4. 16
    Sep 2021
    16:06

    파이썬 키움openAPI 원하는 종목리스트 10호가까지 피라미드 매수주문하기

    Category파이썬 Views3568
    Read More
  5. 25
    Feb 2023
    12:36

    파이썬 비활성화 된 창 활성화 시키기

    Category파이썬 Views3551
    Read More
  6. 13
    Sep 2021
    23:04

    키움증권 openAPI 지정가분할매수주문.py

    Category파이썬 Views3532
    Read More
  7. 23
    Sep 2021
    22:29

    파이썬 팍스넷 추천종목 특정페이지 크롤링

    Category파이썬 Views3466
    Read More
  8. 26
    Mar 2016
    09:50

    윈도우 TCP 연결의 개수를 최대한 늘이기

    CategoryServer Views3456
    Read More
  9. 18
    Sep 2021
    09:46

    Python 메타블로그 글쓰기(제로보드, xpressengine blog api)

    Category파이썬 Views3433
    Read More
  10. 31
    Jul 2021
    12:53

    파이썬 FTP 업로드/다운로드 하기

    Category컴퓨터잡담 Views3393
    Read More
  11. 04
    Nov 2020
    18:17

    크롬에서 플래시 사용하기

    Category컴퓨터잡담 Views3386
    Read More
  12. 10
    Mar 2023
    14:33

    네이버 주식의 기업정보와 펀더멘탈정보 소스 가져오기

    Category파이썬 Views3366
    Read More
  13. 21
    Mar 2015
    11:24

    사용자 계정 컨트롤 화면 없애기

    CategoryWindowsTip Views3312
    Read More
  14. 17
    Sep 2021
    08:43

    python 에서 구글 캘린더 api 이용하기(server to server)

    Category파이썬 Views3277
    Read More
  15. 03
    Mar 2015
    09:07

    웹하드 서버 구축하기

    CategoryServer Views3276
    Read More
  16. 09
    Jul 2021
    13:48

    엑셀에서 "따옴표" 입력하기

    CategoryExcel Views3213
    Read More
  17. 26
    Oct 2021
    05:59

    python html tag 제거 경로 금지 문자 제거

    Category파이썬 Views3180
    Read More
  18. 31
    Oct 2021
    12:12

    파이썬 정규표현식 (Regular Expressions)

    Category파이썬 Views3180
    Read More
  19. 22
    Jan 2015
    13:08

    exFAT 이동식 USB 하드 쓰기 금지 문제 해결방법

    CategoryWindowsTip Views3108
    Read More
  20. 18
    Aug 2016
    07:13

    아파치 mod_cache mod_disk_cache 알아보기

    CategoryServer Views3096
    Read More
Board Pagination Prev 1 ... 37 38 39 40 41 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소