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

단축키

Prev이전 문서

Next다음 문서

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

단축키

Prev이전 문서

Next다음 문서

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

파이썬 한우정액 정보 스프레드로 추출하기

 

 

 

 

import time
from unicodedata import lookup #time 명령어 사용하기 
from bs4 import BeautifulSoup # BeautifulSoup 불러오기






 
#파이썬 requests 모듈은 간편한 HTTP 요청처리를 위해 사용하는 모듈로 별도로 설치해 주어야 한다.
import requests #pip3 install requests
 
#정액사이트 http://www.limc.co.kr/KpnInfo/KpnDetail.asp?KpnNo=1146%20&chk=B&cKPNno=
group = '1그룹'
search_data = '1243'
 
url = "http://www.limc.co.kr/KpnInfo/KpnDetail.asp?KpnNo=" + search_data + "%20&chk=B&cKPNno="
html = requests.get(url)
bs_html = BeautifulSoup(html.content,"html.parser")
 
#체형정보
form = bs_html.select("table.t07 tr")[2]
sirloin = form.select("td")[2].text
print(sirloin#등심값
 
form = bs_html.select("table.t07 tr")[12]
ht = form.select("td")[2].text
print(ht#체고
 
form = bs_html.select("table.t07 tr")[14]
lh = form.select("td")[2].text
print(lh#체장
 
#유전능력
form = bs_html.select("table.t06 tr")[1]
cold_wt1 = form.select("td")[0].text #냉도체중EPD
bcjg1 = form.select("td")[1].text #배최장근단면도EPD
bk_fat1 = form.select("td")[2].text #등지방두께EPD
ir_fat1 = form.select("td")[3].text #근내지방도EPD
 
form = bs_html.select("table.t06 tr")[2]
cold_wt2 = form.select("td")[0].text #냉도체중Acc
bcjg2 = form.select("td")[1].text #배최장근단면도Acc
bk_fat2 = form.select("td")[2].text #등지방두께Acc
ir_fat2 = form.select("td")[3].text #근내지방도Acc


 
#결과값 스프레드로 전달하기
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = [
'https://spreadsheets.google.com/feeds',
'https://www.googleapis.com/auth/drive',
]
json_file_name = 'C:\\Users\\크리스퍼\\python_code\\JSON주소.json'
credentials = ServiceAccountCredentials.from_json_keyfile_name(json_file_namescope)
gc = gspread.authorize(credentials)
spreadsheet_url = '파일주소'
# 스프레스시트 문서 가져오기 
doc = gc.open_by_url(spreadsheet_url)
# 시트 선택하기
worksheet = doc.worksheet('정액')
 
#print(now + " ||| " + eps + " ||| " + bps + " ||| " + per + " ||| " + upper + " ||| " + pbr + " ||| " + allocation)
worksheet.insert_row([groupsearch_datasirloinhtlhcold_wt1bcjg1bk_fat1ir_fat1cold_wt2bcjg2bk_fat2ir_fat2], 3)

 

 

스프레드시트로 전송한 결과 이미지

휴지통.png

 

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

?

  1. 05
    Jan 2013
    12:36

    패킷을 훔치는 ARP Spoofing 공격 탐지 툴과 방어방법

    CategoryWindowsTip Views13573
    Read More
  2. 15
    Jan 2013
    16:48

    파일도우미삭제(익스플로러 시작시 log.pluspage.co.kr로 접속 후 홈으로 이동하는 증상)

    Category컴퓨터잡담 Views16610
    Read More
  3. 13
    Jul 2015
    23:23

    파일 업로드 폴더 변경

    CategoryServer Views1953
    Read More
  4. 15
    Jun 2021
    08:28

    파이썬의 IF문 사용시 실행값에서 오류발생시 진행하는 예외처리 방법

    Category컴퓨터잡담 Views2870
    Read More
  5. 13
    Jan 2023
    08:42

    파이썬을 이용하여 매크로 만들기

    Category파이썬 Views9211
    Read More
  6. 24
    Aug 2021
    16:43

    파이썬으로 키움증권 open api 사용해보기

    Category컴퓨터잡담 Views1490
    Read More
  7. 25
    Feb 2023
    12:03

    파이썬으로 비활성화 된 창의 이미지를 캡쳐하는 방법

    Category파이썬 Views4004
    Read More
  8. 05
    Jun 2021
    12:33

    파이썬으로 네이버 증권정보 추출하기

    Category컴퓨터잡담 Views1874
    Read More
  9. 25
    Mar 2023
    12:40

    파이썬으로 captCha 분석하여 웹사이트 소스 가져오기

    Category파이썬 Views19044
    Read More
  10. 15
    Sep 2023
    14:04

    파이썬에서 인식이 잘되는 OCR 종류

    Category파이썬 Views77616
    Read More
  11. 25
    Mar 2023
    09:40

    파이썬에서 captCha 분석 프로그램을 만들 수 있을까?

    Category파이썬 Views11724
    Read More
  12. 03
    Sep 2021
    08:37

    파이썬(python) 자주 사용하는 명령 모으기

    Category컴퓨터잡담 Views884
    Read More
  13. 26
    Nov 2022
    10:39

    파이썬 화면 캡쳐하기

    Category파이썬 Views19343
    Read More
  14. 05
    Jun 2021
    23:13

    파이썬 한우정액 정보 스프레드로 추출하기

    Category컴퓨터잡담 Views1625
    Read More
  15. 23
    Sep 2021
    22:29

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

    Category파이썬 Views3466
    Read More
  16. 15
    Aug 2021
    17:42

    파이썬 파일로 읽어올 때 \n이 \\n으로 변경되는 현상 대처방법

    Category컴퓨터잡담 Views1341
    Read More
  17. 08
    May 2022
    08:40

    파이썬 파이인스톨러 설치하기

    Category파이썬 Views21421
    Read More
  18. 16
    Jun 2021
    07:51

    파이썬 파라미터 변수값 전달받기

    Category컴퓨터잡담 Views2040
    Read More
  19. 02
    Sep 2021
    16:09

    파이썬 키움증권 open api 스크랩

    Category컴퓨터잡담 Views969
    Read More
  20. 07
    Sep 2021
    16:33

    파이썬 키움증권 open api 분할매매 주문하기

    Category파이썬 Views2340
    Read More
Board Pagination Prev 1 2 3 4 5 ... 46 Next
/ 46

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


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

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

설치 취소