Nov 12
箇 Leopard 批遣 Python 其璅∪銝銝剜憿
隞乩 MacPorts 鋆 Python 2.6嚗鋆憟賭敺箇
To fully complete your installation and make python 2.6 the default, please run
sudo port install python_select
sudo python_select python26
python_select嚗Switch the default python interpreter
隞斤扳瘝=.=
航芸楛雿蝯瘥頛靽
sudo ln -s /opt/local/bin/python python
Tagged with: cli • osx • Python • tips • Unix-like
Nov 11
settings.py 蝺刻摩
隤踵
TIME_ZONE = 'Asia/Taipei'
隤蝟餉矽
LANGUAGE_CODE = 'zh-tw'
Tagged with: Django • Python
Nov 05
tchinese.py
#!/bin/python
print "Python臬瑞拇"
python tchinese.py
SyntaxError: Non-ASCII character '\xe6' in file tchinese.py on line 2, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
航炊閮臭葉蝯圈蝭蝡嚗PEP 0263 — Defining Python Source Code Encodings
銝剜堆
To define a source code encoding, a magic comment must be placed into the source files either as first or second line in the file, such as:
or (using formats recognized by popular editors)
#!/usr/bin/python
# -*- coding: <encoding name> -*-
or
#!/usr/bin/python
# vim: set fileencoding=<encoding name> :
Example:
#!/bin/python
# -*- coding: utf-8 -*-
print "Python臬瑞拇"
Result:
Tagged with: CJKV • Programming • Python • tips • UTF-8
Jan 14
曆銝銝銝蝔桀隤閮瘥頛嚗靘撠撠渡銝銝
Perl
Perl 隤閮銝剖喳臭誑箔亥店TMTOWTDI嚗
There’s More Than One Way To Do It.
嚗銝芯蝔格寞靘隞嗡嚗
Perl 雿 Larry Wall 撱箄降臭誑蝮桀神閰敹菜Tim Toady
虫撣詨虜霈鈭箸唾絲 Perl 靽隤荔
Easy things should be easy, and hard things should be possible.
Python
Python 潭鈭 Tim Peters 撖怎 python 潸嚗蝔梁摭he Zen of Python嚗嚗
There should be one– and preferably only one –obvious way to do it.
Ruby
KISS嚗Keep It Super Simple嚗
POLS嚗撠撽閮嚗嚗Principle Of Least Surprise
鞈1嚗鈭箄 – Ruby嚗Python嚗Perl 銝剖喟銝
鞈2嚗Lighty RoR: Ruby 頝 Python 祈釭銝銝
鞈3嚗INET6: 憭抵敺憭拍撘隤閮憸冽
Tagged with: Perl • Programming • Python • Ruby
啣