전체 글 (8) 썸네일형 리스트형 [Python] selenium을 활용하여 해외 증시 정보 크롤링하기 selenium을 활용해 간단하게 네이버 금융 페이지에서 해외증시 정보를 가져와보았다. (https://github.com/aruymeek/python_Selenium/tree/master/chrometest) 1. selenium 설치 selenium 모듈을 import 하기에 앞서 설치를 먼저 해준다. !pip install selenium 설치하면 selenium이 정상적으로 import 되는 것을 확인할 수 있다. from selenium import webdriver 2. 클래스 생성하기 이번에도 class를 하나 만들어서 정보를 간편하게 다룰 수 있게 해주었다. class StockModel: def __init__(self, _nat, _idx, _now, _diff, _pct): self... [Python] BeautifulSoup으로 수집한 데이터를 txt 파일로 저장하기 실제 뉴스 기사에서 표 데이터를 추출하고, txt 파일로 저장해보았다. (https://github.com/aruymeek/python_BeautifulSoup/tree/master/crawlingtest) https://www.corporateknights.com/reports/2020-global-100/2020-global-100-ranking-15795648/ 2020 Global 100 ranking | Corporate Knights For more detailed dataset, return to 2020 Global 100 landing page and click 'Free results.' Want to dive deep into the data? Purchase our www.corpo.. [Python] BeautifulSoup으로 데이터(html) 수집하기 BeautifulSoup으로 웹 html 데이터를 수집해보았다. (https://github.com/aruymeek/python_BeautifulSoup/tree/master/sportstest) 네이버 스포츠(https://sports.news.naver.com/index.nhn)에서 뉴스 기사의 제목, 링크, 내용, 언론사 등의 정보를 수집해보려고 한다. 네이버 스포츠 메인화면에서 보이는 기사 중, 빨간색 사각형으로 표시해 둔 부분의 정보만 가져왔다. 1. 클래스 생성하기 먼저 데이터를 간편하게 관리(?)하기 위해 SportsModel 클래스를 생성했다. class SportsModel: def __init__(self, _title, _href, _content, _media, _league): s.. [Python] BeautifulSoup 연습하기 Python으로 crawling 할 수 있는 방법 중 하나인 BeautifulSoup을 활용해 테이블(표)의 내용을 추출하는 연습을 해보았다. (https://github.com/aruymeek/python_BeautifulSoup/tree/master/parsingtest) BeautifulSoup을 사용하기 위해서 아래와 같이 모듈을 import 해준다. from bs4 import BeautifulSoup 연습을 위해 하나의 웹페이지를 만들어두었다. 이 페이지에서 테이블(표)의 내용을 추출하는 연습을 했다. html을 열어 f 에 할당한 후, BeautifulSoup()을 이용해 모든 소스코드를 출력할 수 있다. f = open(r"C:/Users/Desktop/info.html", encoding.. [Python] class를 활용하여 영화 목록 관리하기 첫번째 글에서 여러가지 함수를 정의하고 dictionary를 활용해 영화 목록을 만들어봤다. 이번에는 더 간단하게 class를 활용해보려고 한다. (https://github.com/aruymeek/python_basic/tree/master/modeltest) 1. 클래스 정의하기 먼저, 배우 정보 관리에 사용될 클래스를 생성하면, 아래처럼 만들어볼 수 있다. class ActorModel: movie_key = '' name = '' age = 0 def __init__(self, _key, _name, _age): self.movie_key = _key self.name = _name self.age = _age def ShowActorInfo(self): print('Movie Key: {0}, .. 이전 1 2 다음