ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

python ¿Ä¸ê¿Ä¨é·JÁ` (¥þ³¡)"¸ê®Æ

¨ä¹ê§A´£¨ìªº ¡G
"¥Ø«eªº·Qªk¬O   python §ì¨ú¸ê®Æ¦Ü sqlite3¡Avba ±q sqlite3 ¨ú¥X¸ê®Æ"
¦b¹ê°È¤W³oºØ ...
c_c_lai µoªí©ó 2016-9-30 15:22


­ì¨Ó¦p¦¹¡A¤p§Ì¬O¬Ýªø´Á¤ë½uªº¡A©Ò¥H¬O­n²Î­p¾ú¥v¸ê®Æ¨S¦³¿ù
½u¤W§Y®É§@·~ ¤p§Ì¨S¿ëªk¡A­ì¨Ó¬O¾Þ§@¤âªkªº¤£¦P

¬G¡Aªd¥Îpython¨ú¥Xsql¤ºªºªí®æ¡A¥u¬O³æ¯Â­nµe¹Ï¡H
¦L¹³¤¤   ¥xÆWªº ½u¤W§Y®É§@·~ ³£¬O¥Î excel ¡]°ê¥~Å¥»¡§ï±¼¤F¡^
¥Îvba¤~¥i¥H§Y®É¤¬°Ê   pythonÀ³¸ÓÁÙ¤£¦æ~~¤£¹L¤]¤£¤@©w¡A»¡¤£©w¦hgoogle  ´N¦³°ª¤â§@¥X¨Ó¤F©O

ps:«y«y~~¤j®a¤W¯Z¤£¤W¯Zªº¦b²á³o­Ó¡A«¢«¢«¢

TOP

¦^´_ 49# c_c_lai


   §A°õ¦æªº±¡ªp¡A¯uªº«Ü©_©Ç¡I§Ú°õ¦æ¤F3¦¸±q2016/1/1¨ì2016/9/29 ¤]³£¨S¦³±o¨ì¹³§A¤@¼Ëªºµ²ªG
§A¦A§â¸ê®Æ®w§R±¼¡AÆ[¹î²Ä¤@¦¸¬O¤£¬O·|¤£§¹¾ã¡A±q2016/1/1¨ì2016/9/29¦@¦³170µ§¸ê®Æ¡A¬Ý¬O¤£¬O·|¤£°÷
§Úµ{¦¡¸Ì­±¡A¥u¦³´¡¤JINSERT INTO...¨Ã¨S¦³­×§ïªº»y¥y¦Ó¥B·í¦³­«ÂЭȮɡA¨Ã¤£·|°õ¦æ¥ô¦ó°Ê§@
except Exception as e:
            pass
¦A³Â·Ð§A¤F

TOP

¥Ñ©ó sqlite3 ¦b¤é´Á®É¶¡ ¬O¥H¤å¦r¦ê¦s¤J¡A¦Ó«D¥H¤é´Á®É¶¡®æ¦¡¦s¤J(¦p¡G#2016/01/06#)
¦Ósqlite3ªºdate¨ç¼Æªº¤é´Á®æ¦¡¥²¶·¹³'2016-01-06'¦~¤ë¤é»Ý¥H'-'¹j¶} ¡A­Y¥H'2016/01/06' ±×½u '/'¹j¶}¡A¥HSQL»yªk·|µLªk­pºâ
©Ò¥H¦b¦s¤Jsqlite3¸ê®Æ®wªº¤é´Á¡A¥²¶·¥ý³B²z

¦b dd=dat.strftime('%Y/%m/%d')ªº¤U¦æ»Ý¥[¤J¥t¤@¥y
sqldate=dat.strftime('%Y-%m-%d')

¦Ó³o¥yadd_data(regs=re,date=dd)¥²¶·­×§ï¬°
add_data(regs=re,date=sqldate)

¦b¥H«áªº¤é´Á³B²z¡A´N·|®e©ö³B²z¤F

sqlite3¦b¤é´Á¬d¸ß¤è­±¡A¨Ò¦p»¡­n¬d¸ß '2016-01-01' ¨ì '2016-01-31'
¦bSQL»yªk¤è­± ­ì¨Óªº¥Îªk WHERE ¤é´Á BETWEEN '2016-01-01' AND '2016-01-31'
¦Ósqlite3 «o¤£¯à¥H BETWEEN ¥h³B²z¡A´N¹³«e­±»¡ªº¡A¤é´Á®É¶¡ ¬O¥H¤å¦r¦ê¦s¤J¡A¤å¦r¦ê¤£¯à¥Î¦b¤é´Á®É¶¡³B²z

©Ò¥Hsqlite3ªºSQL»yªk¬°
"select * from [0050] where julianday(¤é´Á)>=julianday('2016-01-01') and julianday(¤é´Á)<=julianday('2016-01-31')"

TOP

¦^´_ 52# lpk187
§Úªº¬O 179 Records¡C

TOP

¤Ó´Î¤F!  ÁÂÁ¤j¤jªº¤À¨É~~

TOP

½Ð°Ý¦U¦ì¤j¤j¡A³Ìªñ¤£·Q±qÃÒ¥æ©Ò§ì¸ê®Æ¡A§ï¦V¹d¦ëºô¡A¤£¹L¦bºô­¶¸ÑªR¤W¨S¸gÅç(¤§«e¬O½Ð±Ð§O¤H«á¡A¦A¨Ì¼Ë¹º¸¬ÄªºCºC§ï¥X¦Û¤w·Q­nªº)
­ìµ{¦¡³¡¥÷Àɦpªþ¥ó¡A

  ­Y§ï¥Ñ¹d¦ëºô¤U¸ü¸ê®Æªº¸Ü¡A±qºô¸ô¤W¬Ý¤å³¹¡A¨ä¤¤§ï¦¨¥H¤U¡A¤£¹L¦n¹³¨S¿ìªk°e¥X¬d¸ß¡A·Q½Ð±Ð¬O­þ¸Ì¥X°ÝÃD??
          = "    cnyes.com/twstock/ps_historyprice/" + (cell21)+".htm"
    classSelectTextStart = (str(yy-1)+"/"+str(mm)+"/"+str(dd))
    classSelectTextEND = (str(yy)+"/"+str(mm)+"/"+str(dd))
  
    browser.find_element_by_id("ctl00_ContentPlaceHolder1_startText").send_keys(classSelectTextStart)
    browser .find_element_by_id("ctl00_ContentPlaceHolder1_endText").send_keys(classSelectTextEND)
    browser.find_element_by_id("ctl00_ContentPlaceHolder1_submitBut").send_keys(Keys.ENTER)
    time.sleep(10)

­ì©lÀÉ.tar (4.5 KB)

TOP

¤p§Ì¬Oµ{¦¡·s¤â¡A©Ò¥H¤°»ò³£¤£À´¡A·|¶Ãµo°Ý¡A½Ð¨£½Ì¼K~~

TOP

        ÀR«ä¦Û¦b : §ïÅܦۤv¬O¦Û±Ï¡A¼vÅT§O¤H¬O±Ï¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD