随笔分类 -  python

摘要:每当要对序列中的内容进行循环处理时,就应该尝试用list comprehensions代替它>>> i = iter('abc')>>> i.next()'a'>>> i.next()'b'>>> i.next()'c'>>> i.next()Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> i.ne 阅读全文
posted @ 2012-05-30 18:59 ghost&240 阅读(1297) 评论(0) 推荐(0)
摘要:在线教程: http://docs.python.org/tut/tut.htmlwithopen("/home/ghost/had.txt", "w") as f: with语句可以在执行语句后自动关闭文件学习描述符__get__ __set__P84(高级)学习装饰器学习select模块中的epoll类importcollections 用于双端队列类 dequeimportheapq 用于堆函数的导入importfileinput 用于读取文件类的导入importsys 用于系统的一些东西导入imp... 阅读全文
posted @ 2012-05-30 18:53 ghost&240 阅读(1025) 评论(0) 推荐(0)