ÆÄÀ̽ã Å©·Ñ¸µ ÀßÇϽôºРµµ¿ò ¿äûµå¸³´Ï´Ù...

   Á¶È¸ 3135   Ãßõ 0    

http://hkconsensus.hankyung.com/apps.chart/chart.chartList?callback=jQuery112406638263512384042_1563692725032&report_type=CO&business_code=005930&_=1563692725033


위 사이트에서 정보를 좀 긁어오려하는데 아래와같이 코드를 짜도 아무 결과를 내어놓지를 않아서...질문을 드립니다.

또한 위의 파란색 음영부분을 txt파일에 100개정도 저장해놓고 순차적으로 결과치를 txt파일이나 엑셀파일로 저장하려는데 방법이 있을까요?



from urllib.request import urlopen

from bs4 import BeautifulSoup

html = urlopen("http://hkconsensus.hankyung.com/apps.chart/chart.chartList?callback=jQuery112406638263512384042_1563692725032&report_type=CO&business_code=005930&_=1563692725033")

soup = BeautifulSoup(html, "lxml")

print(soup)

ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
NaN 2019-07
À§ÀÇ ÆĶõ»ö À½¿µºÎºÐÀ» txtÆÄÀÏ¿¡ 100°³Á¤µµ ÀúÀåÇسõ°í ¼øÂ÷ÀûÀ¸·Î °á°úÄ¡ -> txtÆÄÀÏÀ» ¶óÀκ°·Î ó¸®ÇϽøéµË´Ï´Ù.
https://stackabuse.com/read-a-file-line-by-line-in-python/
»ó±â ¸µÅ©ÀÇ ´ÙÀ½ºÎºÐÀ» Âü°íÇϽøéµË´Ï´Ù.

 filepath = 'Iliad.txt'
with open(filepath) as fp:
  line = fp.readline()
  cnt = 1
  while line:
      print("Line {}: {}".format(cnt, line.strip()))
      line = fp.readline()
      cnt += 1
     
°¨»çÇÕ´Ï´Ù~!
±Ùµ¥...Ȥ½Ã À§ÀÇ °á°ú°¡ ¿Ö ¾È³ª¿À´ÂÁö ¾Ë¼ö ÀÖÀ»±î¿ä?
Èñ¾ÈÇÏ°Ô ¾Æ¹«·± °á°ú°¡ ³ª¿ÀÁú ¾Ê½À´Ï´Ù....
NaN 2019-07
°á°úÄ¡¸¦ txtÆÄÀÏÀ̳ª ¿¢¼¿ÆÄÀÏ·Î ÀúÀåÇÏ·Á´Âµ¥ ¹æ¹ýÀÌ ÀÖÀ»±î¿ä -> ÆÄÀ̼±ÀÇ csv ¶óÀ̺귯¸®¸¦ ¾²½Ã¸éµË´Ï´Ù.
csvÀÇ writerºÎºÐÀ» Âü°íÇÏ½Ã¸é µÉ°Í°°½À´Ï´Ù.
https://realpython.com/python-csv/
¶óÀκ°·Î ·çÇÁ¸¦ »ç¿ëÇϽøé ÆÄÀÏ¿¡ ¶óÀÎÀ» Ãß°¡ÇؾßÇÏ´Ï writerow ºÎºÐµµ Âü°íÇϼžßÇÒ°Í°°½À´Ï´Ù~
Èì³Ä 2019-07
import requests


from bs4 import BeautifulSoup

url = "http://hkconsensus.hankyung.com/apps.chart/chart.chartList?callback=jQuery112406638263512384042_1563692725032&report_type=CO&business_code=005930&_=1563692725033"

headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36'}

html = requests.get(url,headers = headers).text
soup = BeautifulSoup(html, "lxml")


print(soup)


ÇØ´õ Á¤º¸ ¾ø¾î¼­ ±×·±°Å °°³×¿ä. ÀÌ·¸°Ô Çغ¸¼¼¿ä.
     
¿À~! µË´Ï´Ù °¨»çµå·Á¿ä~!!!


QnA
Á¦¸ñPage 4373/5613
2014-05   4598950   Á¤ÀºÁØ1
2015-12   1147390   ¹é¸Þ°¡
2015-07   3145   izegtob
2015-12   3145   Ãʺ¸IT
2018-07   3145   ´ÃÆĶõ
2020-11   3145   Å©¸²¿ÀºêÅ©¶ø
2016-09   3145   NickName123
2015-03   3145   cyberten
2019-11   3145   À嵿°Ç2014
2021-01   3145   È­Á¤Å¥»ï
2018-05   3144   ³Ä¾Æ¾Æ¾Æ¾Ï
2014-09   3144   °æ¹ÚÇѽùÎ
2017-06   3144   ±èÈ¿¼ö
2014-03   3144   Won³«¿¬
2016-03   3144   ¼ÛÁÖȯ
2018-01   3144   ¸¶Åë
2018-04   3144   ³ª¶ó»ç¶û
2019-12   3144   Á¶ÀçÇü3
2015-01   3144   À̱⼷
2017-03   3144   DoubleSH
2019-12   3144   ³ªºñz
2018-07   3144   ³×ÀÌÃÄ