2012年3月15日星期四

批处理文件,执行多个命令

start /d "路径" 可执行程序  参数

2012年3月8日星期四

pylons学习(续)

学习Pylons的示例,最好用英文目录下测试,中文目录下很多编码问题,
目前还没找到好的办法解决中文目录造成的模板显示问题。

1,response ,request用法
2,Pylons提供了多种调试问题的方式,
网页调试
3,mako  Template技术
各种技术都大体类似
Mako语法的注释
<%doc></%doc>
##
输出文本语法
<%text></%text>
%  后面可以跟可执行的python命名
<%    %>中间是代码段
<%!     %>   module级的代码块,里面的内容只被执行一次


Mako模板调试
wingware提供了一种方式,蛮好用的,分享一下
To avoid this, do not specify the --reload flag for Paste. Place the following in a file that you add to your project and set as the main debug file:

from paste.script.serve import ServeCommand
ServeCommand("serve").run(["development.ini"])

This may vary somewhat, as necessary for your application.

http://wingware.com/doc/howtos/paste-pylons

pylons安装

pylons安装
1,安装python2.7
2,配置path环境,可以直接在命令行上使用python.exe
3,安装easy_install
python  ***ez_setup.py(从pypi网站下载)
并添加easy_install.exe所在目录到path环境
4,安装Pylons
easy_install Pylons
更新
easy_install -U Pylons
5,创建示例
paster create -t pylons HelloWorld

6,启动
paster server --reload development.ini

--reload,当文件改变时,自动重启服务

7,paster controller 建立controller
paster controller Hello
controller中可以使用的request,response变量

8,route文件配置,
config/route.py






2012年3月7日星期三

python学习笔记



Python与c#区别
仅作笔记,做不得学习的资料
1,浮点数可以取余
2,获取用户输入
input,rawinput
3,模块引入
import ,C#已命名空间方式引入using
4,python,math.floor方法的结果是浮点数
5,序列 数组操作

数组append,pop;pop可以接收参数,对应C#,push,pop

6,字符串
字符串格式化,元组的使用,
Template使用
字符串精度,对齐,填充

字符串查找


7,字典

8.函数,
以缩进表示作用域

9类,
self
__init__方法

10,文件读写


11,模块使用
 核心模块
os,
os.path.
sys
re
动态导入

12,异常处理

13,特殊的方法
__getitem__索引操作符

14,赋值
可以同时赋多值
and,or返回实际的值


15,内存管理