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

[­ì³Ð] python¤W¥«Âd¤T¤jªk¤H¶R½æ¶W¤é³ø¸ê®Æ¤U¸ü

¦^´_ 46# c_c_lai
¤£¤Ó½T©w±z·Q¹F¨ì¤°»ò¼Ëªº®ÄªG¡A¦pªG¥u¬O­n§â©Ò¦³ªº¸ê®Æ¦C¥X¨Ó¥i¥H¥Îfor°j°é¡A§âprint¨ºÃä§ï¤@¤U¡G
  1. for td in tbl:
  2.     print(td.text)
½Æ»s¥N½X
³o¼Ë¥i¥H²³æ§â§Ú­Ì¨ú¥Xªºtable¸Ìªºtdªº¸ê®Æ¥þ³¡¦L¥X¨Ó¡C¦pªG¬O­n¯S©wªº®æ¦¡¡A¨º´N­n¥t¥~³B²z¡C

TOP

¦^´_ 50# c_c_lai
ipythonªº¸Ü¥i¯à·|¦bC:\Users\µn¤J¤¤¨Ï¥ÎªÌ©³¤U¡A¥i¥H§ä§ä¬Ý¡C

TOP

¦^´_ 51# zyzzyva
ÁÂÁ§A¡I
§Ú·Q¨D¥X¦p¤U¤§¤º®e (µ²ªG) (¦p¹Ï¥Ü)¡G
¤£ª¾¥i¦æ§_¡A¦p¦¹§Ú¤]±o¥H¾Ç¨ì¦p¦ó§ì¨úºô­¶¸ê®Æ¡C
¤@¿s Python ¬O¦p¦ó»´©ö¯à±oª¾µ²ªGªº¡C
·s¼W¬£¤u.png
2016-9-8 10:30

TOP

¦^´_ 51# zyzzyva
§Ú·Q­nªº¥X¨Óµ²ªG¬O¡G(¦p ¤U)
  1. Sub Ex()
  2.     Dim strURL$ '«Å§istrURL¬°ÅܼÆ
  3.     strURL = "http://www.taifex.com.tw/chinese/3/7_12_3.asp"    '©w¸qstrURLÅܼƤº®e
  4.     [a1].CurrentRegion.ClearContents   '  ²M°£¤å¦r¨S²M°£®æ¦¡(¬ü¤Æ¦nªºªí®æ)
  5.    
  6.     With ActiveSheet.QueryTables.Add(Connection:= _
  7.                   "URL;" & strURL, Destination:=Range( _
  8.                   "$A$1"))
  9.         .Name = "´Á³f«´¬ù"
  10.         .FieldNames = True
  11.         .RowNumbers = False
  12.         .FillAdjacentFormulas = False
  13.         .PreserveFormatting = False
  14.         .RefreshOnFileOpen = False
  15.         .BackgroundQuery = False
  16.         .RefreshStyle = xlOverwriteCells
  17.         .AdjustColumnWidth = False
  18.         .WebSelectionType = xlSpecifiedTables
  19.         .WebFormatting = xlWebFormattingNone
  20.         .WebTables = "3"         '   ²Ä 3 ­Ó Table
  21.         .WebPreFormattedTextToColumns = True
  22.         .WebConsecutiveDelimitersAsOne = True
  23.         .WebSingleBlockTextImport = False
  24.         .WebDisableDateRecognition = True
  25.         .WebDisableRedirections = False
  26.         .Refresh BackgroundQuery:=False
  27.         .Delete
  28.     End With
  29. End Sub
½Æ»s¥N½X
·s¼W¬£¤u.png
2016-9-8 10:50

TOP

¦^´_ 49# c_c_lai


    ¬Oªº¤@¼Ë¶i¤J¨ìpython3.5¸ê®Æ§¨ªºScripts¸ê®Æ§¨¶i¦æ ¦w¸Ë  
­Y¬O¦b¨ä¥Lªº¸ê®Æ§¨©Î®Ú¥Ø¿ý¤U¦w¸Ë¡A¤ñ¸û·|¿ù¶Ã¡A¨ä¦]¬O¦w¸Ë¦h­Óª©¥»ªº¶}«Y¡I
¦³®Épip¤£¯à¤U¸ü¦w¸Ë¥i¥H¹Á¸Õ¨ä¥L¦w¸Ë¤èªk ¨Ò¦p¥Î easy_install ¦w¸Ë©ÎªÌ°Ñ¦Ò ¨ä¼Ò¶ôªº©xºô»¡©ú

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2016-9-8 10:58 ½s¿è

¦^´_ 52# zyzzyva
¦^´_ 43# lpk187
¤º®e¬O¡H
·s¼W¬£¤u.png
2016-9-8 10:56

TOP

¦^´_ 50# c_c_lai


    ©Ò²£¥ÍªºÀÉ®×·|¦b³o­Ó©ÒÀx¦sµ{¦¡½X¤Uªº¸ê®Æ§¨¥X²{
¥Hjupyter ¨Ó»¡¤@¯ë³£¦b"¤å¥ó"¸ê®Æ¤¤
a.png
2016-9-8 11:02

TOP

¦^´_ 54# c_c_lai
³q±`§Ú³£¥u»Ý­nºô­¶¸Ì¤Ö¼Æªº´X­Ó¼Æ¦r¡A©Ò¥H¤]¨S¦³»{¯u¬ã¨s¹Lªí®æªº§¹¾ã§ì¨ú¡A³ovbaªºcode¬Ý°_¨Ó¤w¸g«Ü²¼ä¤F¡A
¶]¥X¨Óªº®ÄªG¤]«Ü¦n¡A¦pªG¬O­n©ñ¨ìexcel¸Ì¡A§Ú·|ª½±µ¥Î±zªºcode¡CL¤j´£ªºpandas¥i¥H¹F¨ìÃþ¦üªº®ÄªG¡A¦ý¬O¹³³oºØ®æ¦¡¤ñ¸ûÂøªºÁÙ¬O­n°µ½Õ¾ã¡A
¦A©ñ¨ìexcel¸ÌÀY¥i¯àÁÙ¨S¦³³o­Óº}«G¡C

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2016-9-8 11:27 ½s¿è

¦^´_ 57# lpk187
¦^´_ 58# zyzzyva
ipython ªº¸Ü´N¦p zyzzyva ¤j¤j©Ò»¡ªº¡A
·|¦s¦b¦b C:\Users\ µn¤J¤¤¨Ï¥ÎªÌ©³¤U¡C
¦b¦¹¦V§A­Ì¾Ç¨ì¤F¤£¤Ö Python ªº¦³Ãöª¾ÃÑ¡A
³o¥ç¬O«e°}¤l§Ú¬°¦ó±N Python °±Â\ªº½t¬G¡A
ÁÂÁ§A­ÌËç¡I

TOP

¦^´_ 57# lpk187
¦^´_ 58# zyzzyva
À³¥Î Pandas ¸Õ¥Xµ²ªG¤F¡A
dfs[3][0:][1:] ªº [3] §Y¬°«ü "²Ä¤T­Ó Table" ¤§·N¡C
·s¼W¬£¤u.png
2016-9-8 12:18

TOP

        ÀR«ä¦Û¦b : ¡i¬°µ½Ävª§¡j¤H¥Í­n¬°µ½Ävª§¡A¤À¬í¥²ª§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD