Read and write CSV files with Python

I am analyzing a trace in GTFS, a collection of CSV files. Each record of a csv file is consisting of one or more fields speparated by commas ,. It is error-prone to read csv files by simply using [line.split(',') for line in f.readlines()] for fields might contain commas. Therefore, I decide to switch to the Python module csv.

Read more

在Markdown使用代码高亮Google Code Prettify

Markdown上代码高亮,最开始打算用SyntaxHighlighter(为了跟之前保持一致),折腾了一段时间,发现有个问题很难逾越:SyntaxHighlighter要求<pre>...</pre>间的代码,所有左尖括号<必须全部转化成HTML实体&lt;,详情见博文《在Markdown使用代码高亮SyntaxHighlighter》。所以决定寻找另一款代码高亮,最后选择Google Code Prettify,因为StackOverflow和Google Code也用这个货,除此之外,Google Code Prettify还有一个很酷的特性,可以启发式识别语言。本文分享如何安装Google Code Prettify并介绍如何使其与SyntaxHighlighter兼容。

Read more