摘要: GUI的终极选择:Tkinter 例一:创建一个窗口 例二: 阅读全文
posted @ 2019-04-20 10:34 wwq1204 阅读(88) 评论(0) 推荐(1) 编辑
摘要: ScrapyScrapy 是用 Python 实现的一个为了爬取网站数据、提取结构性数据而编写的应用框架。 Scrapy 常应用在包括数据挖掘,信息处理或存储历史数据等一系列的程序中。通常我们可以很简单的通过 Scrapy 框架实现一个爬虫,抓取指定网站的内容或图片 https://blog.csd 阅读全文
posted @ 2019-04-20 10:08 wwq1204 阅读(89) 评论(1) 推荐(1) 编辑
摘要: 小甲鱼python学习笔记 爬虫之正则表达式 1.入门(要import re) 正则表达式中查找示例: >>> import re >>> re.search(r'FishC','I love FishC.com') <re.Match object; span=(7, 12), match='Fi 阅读全文
posted @ 2019-04-19 14:05 wwq1204 阅读(129) 评论(0) 推荐(1) 编辑
摘要: 小甲鱼python学习笔记 爬虫 一:入门 1.python如何访问互联网 >>> import wwq >>> import urllib.request >>> response=urllib.request.urlopen("http://www.fishc.com") >>> html=re 阅读全文
posted @ 2019-04-17 22:38 wwq1204 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 一:模块命名空间 >>> import test >>> hi() Traceback (most recent call last): File "<pyshell#218>", line 1, in <module> hi() NameError: name 'hi' is not define 阅读全文
posted @ 2019-04-16 19:23 wwq1204 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 一:魔法方法 1.__str__() >>> class A(): def __str__(self): return "小甲鱼是帅哥" >>> a=A() >>> print(a) 小甲鱼是帅哥 2.__repr__() >>> class B(): def __repr__(self): ret 阅读全文
posted @ 2019-04-16 10:44 wwq1204 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 一:类和对象 1.定义类,类的实例化,类方法调用 2.继承 MyList继承列表list class MyList(list): pass list2=MyList() list2.append(2) list2.append(1) list2.append(9) for each in list2 阅读全文
posted @ 2019-04-15 15:40 wwq1204 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 一:异常 1.常用的异常:AssertionError 断言语句assert失败 >>> mylist=['小甲鱼是帅哥'] >>> assert len(mylist)>0 >>> mylist.pop() '小甲鱼是帅哥' >>> assert len(mylist)>0 Traceback ( 阅读全文
posted @ 2019-04-12 21:59 wwq1204 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 一:集合 1.集合是用{}来表示(字典也是用花括号来表示的)。 >>> num={} >>> type(num) <class 'dict'> >>> num2={1,2,3,4} >>> type(num2) <class 'set'> 2.集合里面的元素唯一: >>> num2={1,1,2,3 阅读全文
posted @ 2019-04-12 16:29 wwq1204 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 一:迭代&递归 1.迭代求阶乘 def factorial(n): result=n for i in range(1,n): result*=i return result number=int(input('请输入一个正整数:')) result1=factorial(number) print 阅读全文
posted @ 2019-04-12 11:10 wwq1204 阅读(191) 评论(0) 推荐(0) 编辑