preload
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


隞斤扳瘝=.=

航芸楛雿蝯瘥頛靽

cd /usr/bin/
sudo ln -s /opt/local/bin/python python
Tagged with:
Nov 11

settings.py 蝺刻摩

隤踵
TIME_ZONE = 'Asia/Taipei'

隤蝟餉矽
LANGUAGE_CODE = 'zh-tw'

Tagged with:
Nov 11

摰鋆

tar zxvf Django-*.tar.gz
cd Django-*.
sudo python setup.py install

銝啣獢

~/djcode$ django-admin.py startproject mysite
~/djcode$ ls -a mysite/
./           ../          __init__.py  manage.py    settings.py  urls.py
    __init__.py: 質桅package
    manage.py: 銝cli撌亙瘀霈憒喳臭誑典蝔格孵Django撠獢鈭
    settings.py: Django撠獢閮剖/蝯
    urls.py: 甇乃jango撠獢URL摰

瑁潛沒erver

~/djcode/mysite$ python manage.py runserver
Validating models...
0 errors found
 
Django version 1.1.1, using settings 'mysite.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[10/Nov/2009 19:55:59] "GET / HTTP/1.1" 200 2053
It worked!

It worked!

遁ortIP

python manage.py runserver 8080
python manage.py runserver 0.0.0.0:8080
Tagged with:
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:

# coding=<encoding name>

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:

Python臬瑞拇
Tagged with:
Nov 02
臭砌舐 Python 撌亙瑟賂拙 Python 摮貉梯仿
銝剛陌

餉血隞暻潔臭蝟餃Python蝔撘隤閮摮豢蝡嚗閰行靘蝯西隞亦陛柴渲死孵摮貊蝔撘隤閮嚗脰鈭閫擃餉西敺雿

靘皞嚗摮貊撖怎撘 – Sy3es_wiki

Tagged with:
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: