pythonのお勉強その1

インタプリタのパスを通す癖をつける

$which python
/usr/bin/python
#! /usr/bin/python

エンコードの指定も忘れずに

#! /usr/bin/python
# -*- coding: utf-8 -*-

関数オブジェクトの定義

def funcName(arg):
 	# 処理...
	print arg
	return arg

__name__ はモジュール名を表す。
他ファイルからimportして使用した場合はそのモジュール名、
スクリプトとして実行した場合は"__main__"が入る。

文字列をunicode文字列として扱う

u"文字列"