--
I like python!
My Blog: http://www.donews.net/limodou
UliPad Site: http://wiki.woodpecker.org.cn/moin/UliPad
UliPad Maillist: http://groups.google.com/group/ulipad
--
"""Time is unimportant, only life important!
blogging : http://blog.zoomquiet.org/pyblosxom/
wiki enter: http://wiki.woodpecker.org.cn/moin/ZoomQuiet
in douban: http://www.douban.com/people/zoomq/
"""
List一般叫做列表,你使用"链表"好象不太合适,链表可能用于LinkedList更适合
链表推导式 List Comprehension 还没有见到特别好的翻译,comprehension,比如译为"列表包含式"也许不错。
>knight=['gallahad':'the pure','robin':'the brave']
>for k,v in knight.iteritems():
> print k,v
字典写错了,应该是{}
在导入模块中你说到会搜索PATH环境变量,应该是不行的
>for x in xrange(1,11):
> print '%2d %3d' % (x,x*x)
>#%2d和%3d之间要有空格,d表示为整数
空格不是必须的
>def divide(x,y):
> try:
> result=x/y
> except ZeroDivisionError:
> print "除以0"
> else:
> print '结果是',result
> finally:
> print "计算完成!"
缩近有问题,在else处。而且在2.5版之前,try/finally与try/except不能写在同一个缩近上,即try/except/finally这样的用法是不存在的,上面的需要改为:
def divide(x,y):
try:
try:
result=x/y
except ZeroDivisionError:
print "zero"
else:
print 'result=',result
finally:
print 'finish'
才可以。建议注明一下使用的版本。因为看到后面还有一个with的简单说明。
>class DerivedClassName:(Base1,Base2,Base3):
中间多了一个':'号
>for element in [1,2,3]:
> print element
>98 print element
多了一行没用的
>用Generators(生成器)可以快速定义for...in循环.
这句话说法不对。Generator只是可以生成一个序列,可以通过next()进行调用,它是可以在for in 中使用的,但不是一个for in循环。
> >>
> > 附件乱码,不知道是什么格式的,
> > 建议 7-zip 压缩后分享,
> >> 初学python作的读书笔记,方便平时查阅,如有错误和遗漏,希望各位高手不吝赐教,
> >> 谢谢.
> >>
> >> 另外想问一下python如何用来写动态网站?
> >> 比如php可以写html的代码中,python又是任何完成与html代码的融合的呢?
> >>
> >>
> >>
> >
> >
> 附件重发了一下.rar压缩
>
>
>