Skip to content

Instantly share code, notes, and snippets.

#bs4範例練習 、css selector
win7 中文
pyhton3.4
bs4.4.0
股價收盤價抓取練習.py
只能抓取近一個月,因為網站提供資料有限
xpath筆記
繁簡轉換
參考:http://www.j4.com.tw/big-gb/
以 str.translate 做簡單的繁簡table轉換,但仍有繁簡字一對多的問題
@NEJmark
NEJmark / 財報.py
Last active November 30, 2017 09:16
# -*- coding: utf-8 -*-
import urllib
import lxml.etree as etree
url='http://mops.twse.com.tw/server-java/t164sb01?step=1&CO_ID=2330&SYEAR=2013&SSEASON=1&REPORT_ID=C'
response = urllib.urlopen(url)
html= response.read()
page = etree.HTML(html.decode('cp950'))
item_to_print=[u'基本每股盈餘合計',u'營業收入合計']
for tr in page.xpath('(.//tr[@class="even"]|.//tr[@class="odd"])'):
@NEJmark
NEJmark / uao_decode.py
Last active December 9, 2021 13:14 — forked from andycjw/uao_decode.py
Big5 UAO decodeusage: just do 'import uao_decode.py'unicode_string = big5_string.decode('uao_decode')
# -*- coding: utf-8 -*-
import codecs
import struct
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
u'''
## for example:
## 1. u'築'= \u7bc9, 7bc9(16 進位) = 31689(10進位)
## 2. '築'= '\xbfv'='\xbf\x76'('v'=='\x76'), bf76(16 進位) = 49014
@NEJmark
NEJmark / pipework
Created March 14, 2017 19:15
docker set network
./pipework eth0 ubuntu1 192.168.0.26/24
@NEJmark
NEJmark / Nodejs
Created April 15, 2017 01:47
幹這東西真的很雷,預設版本給你舊的
Ubuntu 14.04 雷暴惹:
幹他媽的更新指令
https://askubuntu.com/questions/594656/how-to-install-the-latest-versions-of-nodejs-and-npm-for-ubuntu-14-04-lts/711976#711976
@NEJmark
NEJmark / 盤後交易制度:
Last active May 15, 2017 00:39
盤後交易制度筆記
參考資料:
http://taifex.learn.hinet.net/media.php?vid=1253&type=1
https://www.fubon.com/futures/home/info_content_20170428_343419.htm
盤後交易制度:
1. 5/15 號掛牌(適用)商品:
國內指數: TX(大台指) MTX(小台指) TXO(台指選擇權)