??xml version="1.0" encoding="utf-8" standalone="yes"?>av日韩在线网站,亚洲天堂成人,国产视频网站在线http://www.aygfsteel.com/shaofan/category/8505.html关于JAVA与Y件工E?/description>zh-cnTue, 05 Jun 2007 00:54:34 GMTTue, 05 Jun 2007 00:54:34 GMT60 Python中h(hun)elp()怎么用?http://www.aygfsteel.com/shaofan/archive/2007/06/05/122036.htmlshaofanshaofanMon, 04 Jun 2007 22:28:00 GMThttp://www.aygfsteel.com/shaofan/archive/2007/06/05/122036.htmlhttp://www.aygfsteel.com/shaofan/comments/122036.htmlhttp://www.aygfsteel.com/shaofan/archive/2007/06/05/122036.html#Feedback0http://www.aygfsteel.com/shaofan/comments/commentRss/122036.htmlhttp://www.aygfsteel.com/shaofan/services/trackbacks/122036.htmlhelp是一个内|函敎ͼ所谓内|函敎ͼ是在Python中被自动加蝲的函敎ͼM时候都可以用。参数分两种Q?/span>

  • 如果传一个字W串做参数的话,它会自动搜烦以这个字W串命名的模块,Ҏ(gu)Q等?/span>
  • 如果传入的是一个对象,׃昄q个对象的类型的帮助?/span>

比如输入help(’print’)Q它?yu)׃L?#8217;print’为名的模块,c,{,找不到就会看到提CZ息。而print在python里是一个保留字Q和pass,return同等Q而非对象Q所以help(print)也会出错((kkkkkkk))?/span>

举个例子Q?br>

1 help(’sys’) #会列出sys模块的帮?/span>
2 = [1,2,3]
3 help(a) #会显Clist的帮?/span>
4 help(a.append) #会显Clist的appendҎ(gu)的帮?/span>

python安装自带的library referenceQ?.1节是关于内置函数的?/p>

Reference Manual?.6节可以找到关于print的东东?/span>



shaofan 2007-06-05 06:28 发表评论
]]>
单对比一下Python/Django和Java/Struts/JSP的请求处理结?/title><link>http://www.aygfsteel.com/shaofan/archive/2007/04/06/109007.html</link><dc:creator>shaofan</dc:creator><author>shaofan</author><pubDate>Fri, 06 Apr 2007 11:11:00 GMT</pubDate><guid>http://www.aygfsteel.com/shaofan/archive/2007/04/06/109007.html</guid><wfw:comment>http://www.aygfsteel.com/shaofan/comments/109007.html</wfw:comment><comments>http://www.aygfsteel.com/shaofan/archive/2007/04/06/109007.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/shaofan/comments/commentRss/109007.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/shaofan/services/trackbacks/109007.html</trackback:ping><description><![CDATA[假设Q用两者写一个最的WEBE序?br>q程可以参照Q?br>1.struts的就太多?随便哪个都可?br>2.python/django可以看limodou写的<a target="_blank" >Django step by step</a><br><br>  <table style="width: 874px; height: 274px;" bgcolor="#ffffff" border="1"> <tbody> <tr bgcolor="#dde6ff"> <td><br></td> <td style="font-weight: bold;">Java/Struts/JSP</td> <td align="left" valign="middle"> <span style="font-weight: bold;">Python/Django</span></td> </tr> <tr bgcolor="#dde6ff"> <td style="font-weight: bold;">开发步?/td> <td>1.在web.xml里配|struts的servlet<br>2.在struts-config.xml里配|URL和action的映?br>3.写action<br>4.写JSP</td> <td align="left" valign="middle">1.在urls.py里配|URL到方法的映射<br>2.写相应的Ҏ(gu)<br>3.写HTML模板</td> </tr> <tr bgcolor="#dde6ff"> <td style="font-weight: bold;" align="left" valign="middle">调用q程</td> <td align="left" valign="middle">1.Ҏ(gu)web.xml的映调用struts的servlet controller<br>2.servlet controllerҎ(gu)struts-config.xml的映调用相应的action<br>3.action处理h<br>4.JSP渲染昄</td> <td align="left" valign="middle">1.Ҏ(gu)urls.py的映调用相应的Ҏ(gu)<br>2.Ҏ(gu)处理h<br>3.HTML渲染昄</td> </tr> </tbody> </table> <br><br>相比之下前者用了两层才把一个HTTPh映射到实际处理的Ҏ(gu)Q第一ơ是servlet的映,W二ơ是struts action的映?br>而django则一ơ就从URL映射到相应的Ҏ(gu)了?br><br>另外一个比较显著的区别Q也是基于java和python的语a上的区别吧,java的所有方法必需包含在一个类中,因此action mapping配置时是映射到类Q而action在实现类则应实现事先U定的方?通过l承或实现接?。而django则直接得多,可以直接在配|里写明处理h的方法名?br><br><br><img src ="http://www.aygfsteel.com/shaofan/aggbug/109007.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/shaofan/" target="_blank">shaofan</a> 2007-04-06 19:11 <a href="http://www.aygfsteel.com/shaofan/archive/2007/04/06/109007.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个Linux下显C目录树的脚?/title><link>http://www.aygfsteel.com/shaofan/archive/2006/08/01/61122.html</link><dc:creator>shaofan</dc:creator><author>shaofan</author><pubDate>Tue, 01 Aug 2006 00:57:00 GMT</pubDate><guid>http://www.aygfsteel.com/shaofan/archive/2006/08/01/61122.html</guid><wfw:comment>http://www.aygfsteel.com/shaofan/comments/61122.html</wfw:comment><comments>http://www.aygfsteel.com/shaofan/archive/2006/08/01/61122.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/shaofan/comments/commentRss/61122.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/shaofan/services/trackbacks/61122.html</trackback:ping><description><![CDATA[最q因为Globus的原因,不得不用Linux了。以前几ơ想学,都因为难得要领放弃了。这ơ装?a >Ubuntu</a>Q又y在它的论坛上看到<a >一很不错的教E?/a>Q终于有些“入门”的感觉了。看来找到合适的教程真的是很重要啊。这几天用下来,感觉q真的很不错。用Python写了个显C目录树的小E序。也不知道有没有现成的,反正很简单,刚好ql手Q功能也够我自己用了:)<br /><br /><a href="/Files/shaofan/dtree.rar">下蝲Python脚本</a><br /><br /><img src="http://img539.photo.163.com/rainy14f/46864571/1716495189.jpg" /><br /><img src ="http://www.aygfsteel.com/shaofan/aggbug/61122.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/shaofan/" target="_blank">shaofan</a> 2006-08-01 08:57 <a href="http://www.aygfsteel.com/shaofan/archive/2006/08/01/61122.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我的Python初体?/title><link>http://www.aygfsteel.com/shaofan/archive/2006/03/09/34544.html</link><dc:creator>shaofan</dc:creator><author>shaofan</author><pubDate>Thu, 09 Mar 2006 12:31:00 GMT</pubDate><guid>http://www.aygfsteel.com/shaofan/archive/2006/03/09/34544.html</guid><wfw:comment>http://www.aygfsteel.com/shaofan/comments/34544.html</wfw:comment><comments>http://www.aygfsteel.com/shaofan/archive/2006/03/09/34544.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/shaofan/comments/commentRss/34544.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/shaofan/services/trackbacks/34544.html</trackback:ping><description><![CDATA[<div style="float: left;"><img src="http://www.python.org/images/python-logo.gif"></div><div style="clear: right;">我有一个习惯,每次学门语言Q总要自己写个List或Stackq加上Unit Test来试试。这ơ对Python也不例外。M感觉有以下几?br><br>1.q是我用q的唯一一个把代码行的~进也做法的语言Q就因ؓ不正的~进Q我的第一个PythonE序让我吃尽了苦头。事情是q样的,我运行测试时Q报告每ơ都?Ran 0 test in 0.000s"Q找了半天,也找不出Z么只q行?个测试,一直以为是unittest包的用法有问题,或我的语法有问题Q直到花了大半个时MQ又Ҏ(gu)其他的测试程序以后,才发玎ͼ天啊Q原来是因ؓ最后一行的~进多羃了一层,被认Z上一个方法同一个block?br><br>2.虽然在羃q上吃了苦头Q但是代码看h实相当整洁清楚Q感觉比java的动不动一堆大括号相比Q实在多了?br><br>3.Python的每个moduleQ可以看作与java的包cMQ都可以包含Ҏ(gu)和类Q而java的所有方法都要写在类里,包里只有c,q点相当不同?br><br>4.因ؓPython是用c实现的,它的命名比较单,使用很多~写Q与java的长长一串的命名是很强烈的对?br><br>5.Python是动态类型的语言Q变量不需声明cd可以直接使用Q虽然方便,但缺点也很明显,那就是变量的cd信息不见了,l常搞不清楚Ҏ(gu)的参数要传入什么,q回什么,Z习惯的?br><br>6.因为缺类型信息,Python的文档也没有Java的可L强。比如java?String foo(int a)一看就知道传入整Şq回字符Ԍ换成Python变成了 foo(a)Q只能读文档才能搞清楚了。可能我q没习惯的原因吧Q感觉有时文对它们的类型也说的不太清楚?br><br>M感觉Python一些风格像C。写起代码来Q感觉很快,很清楚,q是很不错的 I love the feeling :)</div><br><br><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><img id="Code_Closed_Image" onclick="this.style.display='none'; Code_Closed_Text.style.display='none'; Code_Open_Image.style.display='inline'; Code_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" height="16" width="11"><img id="Code_Open_Image" style="display: none;" onclick="this.style.display='none'; Code_Open_Text.style.display='none'; Code_Closed_Image.style.display='inline'; Code_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" height="16" width="11"><span id="Code_Closed_Text" style="border: 1px solid rgb(128, 128, 128); background-color: rgb(255, 255, 255);">看看我写的Stack</span><span id="Code_Open_Text" style="display: none;"><br><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 128, 128);"> 1</span> <span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">!/usr/bin/python</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);"> 2</span> <span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);"> -*- coding: cp936 -*-</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);"> 3</span> <span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">Filename:stack.py</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);"> 4</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);"> 5</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> unittest                              </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">引用两个模块Q每个模块实际都是一个py文g</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);"> 6</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 255);">import</span><span style="color: rgb(0, 0, 0);"> testhelper                            </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">本文件也可看作一个模块,可以被引?/span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);"> 7</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);"> 8</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">Stack definition</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);"> 9</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> Stack2:                                </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">行首~进和冒号代替了大括号{}</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">10</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">11</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">def</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">__init__</span><span style="color: rgb(0, 0, 0);">(self, initCap, values</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">[]):  </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">构造方法,values默认gؓI列?/span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">12</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">        self.capacity</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">initCap                </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">表明capacity是一个实例变?/span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">13</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">        self.elements</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">values<br></span><span style="color: rgb(0, 128, 128);">14</span> <span style="color: rgb(0, 0, 0);">    <br></span><span style="color: rgb(0, 128, 128);">15</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">def</span><span style="color: rgb(0, 0, 0);"> pop(self):                           </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">self参数表明它是实例Ҏ(gu)(非static)</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">16</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">        size </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> len(self.elements)<br></span><span style="color: rgb(0, 128, 128);">17</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> size</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">0:<br></span><span style="color: rgb(0, 128, 128);">18</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">raise</span><span style="color: rgb(0, 0, 0);"> Exception()                </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">抛出一个异?/span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">19</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">:<br></span><span style="color: rgb(0, 128, 128);">20</span> <span style="color: rgb(0, 0, 0);">            result </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> self.elements[ size</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);"> ] <br></span><span style="color: rgb(0, 128, 128);">21</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">del</span><span style="color: rgb(0, 0, 0);"> self.elements[size</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">]        <br></span><span style="color: rgb(0, 128, 128);">22</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> result<br></span><span style="color: rgb(0, 128, 128);">23</span> <span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">24</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">def</span><span style="color: rgb(0, 0, 0);"> push(self,value):                    </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">关键字def用来定义一个方?/span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">25</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">        size </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> len(self.elements)<br></span><span style="color: rgb(0, 128, 128);">26</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">( size</span><span style="color: rgb(0, 0, 0);">>=</span><span style="color: rgb(0, 0, 0);">self.capacity ):<br></span><span style="color: rgb(0, 128, 128);">27</span> <span style="color: rgb(0, 0, 0);">            </span><span style="color: rgb(0, 0, 255);">raise</span><span style="color: rgb(0, 0, 0);"> Exception()<br></span><span style="color: rgb(0, 128, 128);">28</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">:<br></span><span style="color: rgb(0, 128, 128);">29</span> <span style="color: rgb(0, 0, 0);">            self.elements.append(value)<br></span><span style="color: rgb(0, 128, 128);">30</span> <span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">31</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">def</span><span style="color: rgb(0, 0, 0);"> size(self):<br></span><span style="color: rgb(0, 128, 128);">32</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> len(self.elements)<br></span><span style="color: rgb(0, 128, 128);">33</span> <span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">34</span> <span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">35</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">Unit test of Stack2</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">36</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 255);">class</span><span style="color: rgb(0, 0, 0);"> TestStack( unittest.TestCase ):<br></span><span style="color: rgb(0, 128, 128);">37</span> <span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 255);">def</span><span style="color: rgb(0, 0, 0);"> test(self):<br></span><span style="color: rgb(0, 128, 128);">38</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">test empty stack construction</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">39</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">        self.stack</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">Stack2(</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">40</span> <span style="color: rgb(0, 0, 0);">        self.assertEquals( 0, self.stack.size() )<br></span><span style="color: rgb(0, 128, 128);">41</span> <span style="color: rgb(0, 0, 0);">        self.assertRaises( Exception, self.stack.pop ) </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">popҎ(gu)作ؓ参数传入</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">42</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">43</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">push elements into it</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">44</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">        self.stack.push(</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">45</span> <span style="color: rgb(0, 0, 0);">        self.stack.push(</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">46</span> <span style="color: rgb(0, 0, 0);">        self.stack.push(</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">)<br></span><span style="color: rgb(0, 128, 128);">47</span> <span style="color: rgb(0, 0, 0);">        self.assertRaises( Exception, self.stack.push, </span><span style="color: rgb(0, 0, 0);">4</span><span style="color: rgb(0, 0, 0);"> )<br></span><span style="color: rgb(0, 128, 128);">48</span> <span style="color: rgb(0, 0, 0);">        self.assertEquals( </span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">, self.stack.size() )<br></span><span style="color: rgb(0, 128, 128);">49</span> <span style="color: rgb(0, 0, 0);"><br></span><span style="color: rgb(0, 128, 128);">50</span> <span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">now pop the elements</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">51</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">        self.assertEquals( </span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">, self.stack.pop() )<br></span><span style="color: rgb(0, 128, 128);">52</span> <span style="color: rgb(0, 0, 0);">        self.assertEquals( </span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">, self.stack.pop() )<br></span><span style="color: rgb(0, 128, 128);">53</span> <span style="color: rgb(0, 0, 0);">        self.assertEquals( </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">, self.stack.pop() )        <br></span><span style="color: rgb(0, 128, 128);">54</span> <span style="color: rgb(0, 0, 0);">        self.assertRaises( Exception, self.stack.pop )<br></span><span style="color: rgb(0, 128, 128);">55</span> <span style="color: rgb(0, 0, 0);">        self.assertEquals( 0, self.stack.size() )<br></span><span style="color: rgb(0, 128, 128);">56</span> <span style="color: rgb(0, 0, 0);">        <br></span><span style="color: rgb(0, 128, 128);">57</span> <span style="color: rgb(0, 0, 0);">        <br></span><span style="color: rgb(0, 128, 128);">58</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">run test</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">59</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">        <br></span><span style="color: rgb(0, 128, 128);">60</span> <span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">__name__</span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">__main__</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">:            </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">判断是否被引?/span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">61</span> <span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">    testhelper.runTest( TestStack ) </span><span style="color: rgb(0, 128, 0);">#</span><span style="color: rgb(0, 128, 0);">只在不是被引用的情况下才执行</span><span style="color: rgb(0, 128, 0);"><br></span><span style="color: rgb(0, 128, 128);">62</span> <span style="color: rgb(0, 128, 0);"></span></span></div><br><img src ="http://www.aygfsteel.com/shaofan/aggbug/34544.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/shaofan/" target="_blank">shaofan</a> 2006-03-09 20:31 <a href="http://www.aygfsteel.com/shaofan/archive/2006/03/09/34544.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Python的资源指?了解Q学?http://www.aygfsteel.com/shaofan/archive/2006/03/05/33659.htmlshaofanshaofanSun, 05 Mar 2006 01:30:00 GMThttp://www.aygfsteel.com/shaofan/archive/2006/03/05/33659.htmlhttp://www.aygfsteel.com/shaofan/comments/33659.htmlhttp://www.aygfsteel.com/shaofan/archive/2006/03/05/33659.html#Feedback3http://www.aygfsteel.com/shaofan/comments/commentRss/33659.htmlhttp://www.aygfsteel.com/shaofan/services/trackbacks/33659.html阅读全文

shaofan 2006-03-05 09:30 发表评论
]]>
վ֩ģ壺 ʯ| | ͨ| | | | | | ˱| | | ͼ| | | | | ʯ| | | ɫ| | | | ʡ| | | ԫ| | | | ϰˮ| ½| | ï| | γ| ɽ| Զ| ֶ| ˮ| |