# py新建文件
* * * * *
>[info] linux下新建py并應行
~~~
# touch hello.py
# chmod u+x hello.py
# vim hello.py
#./hello.py
~~~
* 加入頭信息
~~~
#!/usr/bin/env python
或者
#!/usr/bin/python
~~~
>[info] 完整代碼
~~~
#!/usr/bin/env python
print "hello world"
~~~
>[warning] 中文處理
* python 默認為ASCII碼,無法輸出漢字,需要更改編碼
~~~
#coding=utf-8
或者
#coding=utf8
或
# -*- coding:UTF-8 -*-
或
# -*- coding:utf-8 -*- 大小寫忽略
寫成utf8或utf-8都行
~~~