
Python
文章平均质量分 74
iteye_13917
这个作者很懒,什么都没留下…
展开
-
Python精简学习笔记(一)
输出函数print("This is a string test %s"%"哈哈哈哈") 输入函数s = input("请输入...")数组sz=[1,2,3,'a','b'] 元组yz=(1,2,3,'aaa','bbb') 元组只相当于只读序列,数组可以改变。sz[1]=1111 acceptyz[1]=11...原创 2010-06-04 11:23:24 · 149 阅读 · 0 评论 -
Python精简学习笔记(二) -- 字符串/HTTP
函数:def say(): print("say hello")say() 注意,say()后面有冒号。即python的函数定义、条件判断后面均有冒号 def printMax(a,b): if a>b: print("a is max! %d"%a) if a<b: print("b...原创 2010-06-05 00:11:59 · 144 阅读 · 0 评论 -
Python精简学习笔记(三) -- 类/文件
类class Person: def say(a,b): print("Hello you all! %d"%b) print(a)p=Person()p.say(1) 类中定义的方法,第一个对象总是当前类实例本身 class Person: def __init__(self,name): self....2010-06-05 18:16:25 · 165 阅读 · 0 评论 -
Google's Python Class 1 (Python Introduction)
原文:http://code.google.com/intl/zh-CN/edu/languages/google-python-class/introduction.html Python IntroductionPython是一种动态解释型语言。Python代码不需要为方法和变量指定类型,这种特性让Python保持精简和灵活的同时也牺牲了编译期类型检查的优点。Python会在...原创 2011-12-29 12:15:21 · 218 阅读 · 0 评论 -
Google's Python Class 2 (Python Strings)
原文:http://code.google.com/edu/languages/google-python-class/strings.htmlPython StringsGoogle Code University › Programming LanguagesPython有一个内置的字符串类叫做str,它有很多非常方便的功能 (还有一个比较老的类叫做string,应当避免使用). ...原创 2011-12-29 14:14:04 · 135 阅读 · 0 评论 -
Google's Python Class 3 (Python Lists)
原文:http://code.google.com/edu/languages/google-python-class/lists.html Python ListsGoogle Code University › Programming LanguagesPython拥有一种强大的列表类型: "list". List 通过 [ ]进行声明. Lists与string类型的用...2011-12-30 11:08:26 · 163 阅读 · 0 评论 -
Google's Python Class 4 (Python Sorting)
原文:http://code.google.com/edu/languages/google-python-class/sorting.html Python Sorting(排序)Google Code University › Programming Languages为list排序的最简单方法是使用sorted()函数,它会返回一个排序号的新的list. a = [5,...2011-12-30 13:48:29 · 165 阅读 · 0 评论 -
Google's Python Class 5 (Python Dict and File)
原文:http://code.google.com/edu/languages/google-python-class/dict-files.html Python Dict and FileGoogle Code University › Programming LanguagesDict Hash TablePython有一个高效的哈希表数据结构:"dict"(字典)...2011-12-31 13:40:13 · 177 阅读 · 0 评论 -
用Python Mechanize做爬虫遇到的内存过高问题
今天在用mechanize写了一个爬虫脚本,想要去某网站爬取大概30万张图片。 整个过程是:1、获取目标页面地址2、取得目标地址前几页的所有图片url3、对这些url进行下载,并把索引数据保存到mysql数据库。 这个脚本大概每秒钟完成一张图片的下载(主要是网络只有200K/S左右,是瓶颈) 当图片下载到大约15000张左右的时候,发现越来越慢,最后...2012-03-27 18:36:31 · 487 阅读 · 0 评论