Python: String split and for each

This example shows how to split string and do for…each in Python: >>> rawTags = ‘TAG1 TAG2 TAG3 TAGB1 TAGB2′ >>> tags = rawTags.split() >>> tags ['TAG1', 'TAG2', 'TAG3', 'TAGB1', 'TAGB2'] >>> output = ” >>> for tag in tags: …

by Li Guoliang, | Tagged | Leave a comment

Haskell helloworld

Install Haskell in Linux/Mint sudo apt-get install haskell-platform Hello World GDEV guoliangDev # ghci GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim … linking … done. Loading package integer-gmp … linking … done. Loading package base … linking …

by Li Guoliang, | Tagged | Leave a comment

Ayutthaya 大城游记

除了它本身, 选择去Ayutthaya的理由: 1. 离曼谷很近, 约80KM, 交通方便; 2. 没有很多游客; 交通及住宿 WikiTravel.org 上已有详细介绍: http://wikitravel.org/en/Ayutthaya 我的: 上午到BKK机场, 出海关后问了下info center的人去除了火车站还能在哪买票; 当他了解到我要去Ayutthaya之后, 立刻建议我去Victory Monument [Google Map] 附近坐MiniVan, 大概只需1.5Hrs; 但我是个固执的人, 非要坐火车, 于是: 1. 火车: 列车表可以从泰国铁路网站找到: // 注意: 已经停止网络售票 http://www.thairailticket.com/esrt/Default.aspx?language=1 从BKK坐Airport Link到Makkasan换MRT坐到HuaLamphong / 火车站; 买了一张109去Ayutthaya的三等座: 20 Baht, 没有固定座位, …

by Li Guoliang, | Tagged , , , | Leave a comment

“Harvard ManageMentor Time Management” Notes 时间管理 笔记

Why Manage Your Time? Time management is the discipline of organizing, allocating, and controlling time you use for activities in such a way that you achieve your desired results. Time management forces you to be explicit about what you value …

by Li Guoliang, | Tagged , | Leave a comment

Python: Parse HTML using Beautiful Soup

Requirement: Get the FX rate from: http://fx.cmbchina.com/hq Solution: Use urllib2 to get the html, use BeautifulSoup to parse the html; Details: 1.  Get html by urllib2: import urllib2html = urllib2.urlopen(“http://fx.cmbchina.com/hq”).read() 2. parse the html using BeautifulSoup: install it: $ apt-get …

by Li Guoliang, | Tagged , , | Leave a comment