- ©«¤l
- 55
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 81
- ÂI¦W
- 0
- §@·~¨t²Î
- win
- ³nÅ骩¥»
- 10
- ¾\ŪÅv
- 20
- µù¥U®É¶¡
- 2016-5-15
- ³Ì«áµn¿ý
- 2018-11-1
|
¥»©«³Ì«á¥Ñ koshi0413 ©ó 2016-9-12 20:33 ½s¿è
¤p§Ì§Ú²×©ó¥i¥H¦^ÂФF¡A·P°Ê!!
³o¤å³¹§Ú°l«Ü¤[¤F python ¤]¬O¬Ý¨ì³o½g¤~¶}©l¾Çªº¡A
¦b¦¹½×¾Â¾Ç¤F¤£¤Övba ¤]¬Ý¤F¨Çc_c_lai ¾Ç¨ì¤£¤Ö¡Aè¦n¬Ý¨ìc_c_lai¦³´£°Ý¡A¨Ó³øµª¤@¤U
¤U±¬° c_c_lai ¤§»Ý¨D¡A¤U¸ücsv«Ü¤è«K¡A¤]«Ü§Ö!!! ¦ý¶×¤J SQL³Â·Ð¡An¦bÂà½X¡A¬G¤p§Ì·|¿ï¾Üª½±µ´£¨ú¡]¨ä¹ê¬OÁÙ¤£·|¥Îpythonª½±µÂàcsv½X¦b¦Û°Ê¶×¤JSQL¡^
ps:¥N½X¬°zyzzyvaק睊
pps:·½½X¤¤¬q¸¨¦³ # ¬Ò¬°´£¨úºô¶®É¡A¤ÏÂйêÅç¥Î¡A³oºô¶¬°¤F´£¨ú©Ò¦Ó¬q¸¨¤]ªá¤F¤@¤p®É¨Ó¸Õ¦UºØºô¶¥N½X¨Ó¥ÎBeautifulSoup´£¨ú- # -*- coding: utf-8 -*-
- import requests
- import time
- import os
- from bs4 import BeautifulSoup as BS
- from datetime import date
- headers = {"User-Agent":"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"}
- url1 = "µ¥¯Å¤£°÷¡Aºô§}½Ð¦Û¦æ¿é¤J"
- payload = {"download":'',
- "qdate":'105/09/10',
- "selectType":"ALL"}
- res = requests.post(url1, headers=headers, data=payload)
- #print res.text
- soup = BS(res.text)
- #print soup.select('.board_trad')[0].text
- #tb = soup.select('#main-content')
- #print tb
- #tb = soup.findAll('table')
- soup = soup.select('table')[1]
- #print tb
- for ta in soup.select('tr')[3:]:
- print ta.select("td")[0].text,ta.select("td")[1].text,ta.select("td")[2].text,ta.select("td")[3].text,ta.select("td")[4].text,ta.select("td")[5].text,ta.select("td")[6].text,ta.select("td")[7].text,ta.select("td")[8].text,ta.select("td")[9].text,ta.select("td")[10].text,ta.select("td")[11].text,ta.select("td")[12].text,ta.select("td")[13].text,ta.select("td")[14].text
½Æ»s¥N½X ³o¬Oµ²ªG¡C¥upo«e´X¬q
0050 ¤¸¤j¥xÆW50 194 104 0 1,056 1,146 194,125 0 5 0 496 501 194,125 19
0051 ¤¸¤j¤¤«¬100 0 0 0 2 2 4,500 0 0 0 0 0 4,500 0
0052 FB¬ì§Þ 0 0 0 0 0 2,000 0 0 0 0 0 2,000 0
0053 ¤¸¤j¹q¤l 0 0 0 0 0 3,247 0 0 0 0 0 3,247 0
0054 ¤¸¤j¥x°Ó50 0 0 0 0 0 4,656 0 0 0 0 0 4,656 0
0055 ¤¸¤jMSCIª÷¿Ä 20 5 0 622 637 17,163 0 4 0 118 122 17,163 0
0056 ¤¸¤j°ªªÑ®§ 7 1 0 94 100 67,508 4 0 0 25 21 67,508 3
0057 FB¼¯¥x 0 0 0 0 0 2,006 0 0 0 0 0 2,006 0
0058 FBµo¹F 0 0 0 0 0 1,299 0 0 0 0 0 1,299 0 |
|