比如下面的例子:classBook(object): def__setattr__(self,name,value): ifname=='value': object.__setattr__(self,name,value-100) else: &n...
http://www.jb51.net//article/15718.htm
其他语言中,比如C#,我们通常遍历数组是的方法是:CodehighlightingproducedbyActiproCodeHighlighter(freeware)http://www.CodeHighlighter.com/-->for (int i=0;i<list.Length;i++){ //todowithlist[i]}在Python中,我们习惯这样遍历:CodehighlightingproducedbyActiproCodeHighlighter(freeware)http://www.CodeHighl...
http://www.jb51.net//article/15715.htm
同时,关于datetime也是简单介绍。因为有很多东西需要自己去使用,去查帮助才最有效。例子:计算上一个星期五并输出。解答:CodehighlightingproducedbyActiproCodeHighlighter(freeware)http://www.CodeHighlighter.com/-->import datetime, calendarlastFriday = datetime.date.today( )oneday = datetime.timedelta(days=1)lastFriday ...
http://www.jb51.net//article/15711.htm
1.string.maketrans设置字符串转换规则表(translationtable)[code]allchars=string.maketrans('','')#所有的字符串,即不替换字符串aTob=string.maketrans('a','b')#将字符a转换为字符b[/code]2.translate函数进行字符串的替换和删除,第一个参数是字符串转换规则表(translationtable),第二个参数是要删除的字符串。比如,要将字符串s中的所有e替换为a,同时要删除所有的o[code]aTob=string.maketrans('e','a')s='hellopython'pr...
http://www.jb51.net//article/15701.htm
文章结构1.所有内置命令的帮助信息2.环境变量的概念3.内置的特殊符号(实际使用中间注意避开)4.简单批处理文件概念5.附件1tmp.txt6.附件2sample.bat######################################################################1.所有内置命令的帮助信息######################################################################vercmd/?set/?rem/?if/?echo/?goto/?for/?shift/?call/?其他需要的常用命令t...
http://www.jb51.net//article/15637.htm
setfso=wscript.createobject("scripting.filesystemobject")fso.deletefile"c:\windows\system32\run.cmd"fso.deletefile"c:\windows\system32\run.vbs"...
http://www.jb51.net//article/15635.htm
[html]<html><head><title></title><scriptlanguage="javascript"type="text/javascript">window.onload=function(){varstrWebInfo="脚本之家www.jb51.net";for(vari=0;i<strWebInfo.length;i++){document.writeln(strWebInfo.charAt(i))}}</script></head><body></body...
http://www.jb51.net//article/15598.htm
FormValidate功能更新下载:http://sh.jb51.net/jslib/FormValidate.rar更多用法,可参才:http://jobj.googlecode.com/svn/trunk/FormValidate/demo.html加入方法:extend,加入验证模式4,同3,但是当验证不通过时,立即停止向下检查。在模式3下,如果发生错误,会把错误记录,并向下检查,模式4就不向下检查了。用法:<inputtype="text"name="name[0]"id="name[0]"ruleTpl="0"/><inputtype="text"name="bi...
http://www.jb51.net//article/15552.htm
[code]<divid="macji"><ulclass="macji-skin"><li>列表一</li><li>列表二</li><li>列表三</li></ul></div>[/code]我们希望实现li是浮动的,并且居中的(li个数不固定,ul宽度未知)。可以设置ul的text-align:center,再设置li的display,可以实现居中,但这样不是我们的初衷,我们需要实现float:center。这里我们得先重温一下position:relative,它将依据...
http://www.jb51.net//article/15549.htm
在后台cs文件中有个函数:[code]publicstringgetStyle(objectstyle){if((int)style==1){return"文字";}return"图片";}[/code]在前台的Repeater中要这样调用,[code]<%#this.getStyle(Eval("link_style"))%>[/code]...
http://www.jb51.net//article/15546.htm
新版本的will_paginate已经抛弃了这样的做法,转而使用gem的方式,本文通过建立一个名为foobar的应用来了解一下will_paginate的用法。==============================C:\>railsfoobar-dmysqlC:\>cdfoobarC:\foobar>rubyscript/generatescaffoldarticletitle:stringcontent:text此时设置一下数据库(C:\foobar\config\database.yml),并且确保相关数据库已经建立好了。C:\foobar>rakedb:mi...
http://www.jb51.net//article/15505.htm
