windows & python & Emacs
设置Emacs的HOME,可以在scratch buffer中输入:(insert (getenv "HOME"))查看
下载python-mode.el
用Emacs打开python-mode.el然后M-x byte-compile-file编译python-mode.el为elc
C-h v查看load-path变量
在HOME/.emacs.d/init.el中添加(setq load-path (cons "D:\\emacs-23.1-bin-i386" load-path))
将py文件与python mode 关联,将python解释器与python-mode关联
下载color-theme.el,放入load-path,在init.el中加入:(require ‘color-theme),然后就可以用 M-x color-theme-select 来选择你喜欢的颜色主题了,它会打开一个列表,在每个列表项目上回车会应用那个颜色主题,如果选上了某个主题,按一下 d ,会出现类似:
color-theme-sitaramv-nt is an interactive compiled Lisp function in `color-theme.el'.
(color-theme-sitaramv-nt)
Black foreground on white background.
Includes faces for font-lock, widget, custom, speedbar.
[back]
的东西,其中那句 (color-theme-sitaramv-nt) 加入到你的 ~/.emacs 里面去,就可以永久应用这个颜色主题了。
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\GNU\Emacs]
"HOME"="D:\\emacs-23.1-bin-i386"
(setq load-path (cons "E:\\emacs-23.1-bin-i386" load-path))
(setq auto-mode-alist
(cons '("\\.py$". python-mode) auto-mode-alist))
(setq interpreter-mode-alist
(cons '("python". python-mode) interpreter-mode-alist))
(autoload 'python-mode "python-mode" "Python editing mode." t)
(require 'color-theme)
(color-theme-gnome2)
相关文档:
Python http://www.python.org/download/ wxPython http://www.wxpython.org/download.php#binaries Vpython http://vpython.org/contents/download_windows.html Matplotlib http://sourceforge.net/projects/matplotlib/files/matplotlib/ PyGlet http://www.pyglet.org/download.html PyGame http://www.pyga ......
Ruby和Python的语法比较
其实Ruby和Python非常接近,比大多数别的语言要接近的多,所以喜欢用啥就用啥(大实话,虽然也是废话)。语法上的差别虽然有那么一点,大部分是syntax sugar,我斗胆稍微列几个(python我也忘得差不多了,不对的大家尽管来鞭尸吧),但是主要差异还是设计思想上的:灵活 ......
conn = httplib.HTTPConnection(EPG_IP + ":" + HTTP_PORT)
url = FAV_URL_PARTH +"userid=" + USER_ID + FAV_DIR_MODIFY
param = '''<ps100request id="Favorite.Category.modify">
<categoryid>'''+categoryid+'''</categoryid>
<categoryname>'''+categoryname+'''</ ......
Python内建异常体系结构
BaseException
+-- SystemExit
+-- KeyboardInterrupt
+-- GeneratorExit
+-- Exception
+-- StopIteration
+-- StandardError
| +-- BufferError
| +-- ArithmeticError
| | +-- FloatingPointError
| | +-- OverflowError
| ......
import win32com.client
store = win32com.client.Dispatch('CAPICOM.Store')
# 打开证书存储区
# 2 -> CAPICOM_CURRENT_USER_STORE
# 0 -> CAPICOM_STORE_OPEN_READ_ONLY
store.Open(2, "My", 0)
# 查找有效证书
# 12 -> CAPICOM_CERTIFICATE_FIND_KEY_USAGE
# 0x00000080 -> CAPICOM_DIGITAL_SIGNATU ......