笔记:python (2015)】的更多相关文章

阅读OReilly.Web.Scraping.with.Python.2015.6笔记---Crawl 1.函数调用它自身,这样就形成了一个循环,一环套一环: from urllib.request import urlopen from bs4 import BeautifulSoup import re pages = set() def getLinks(pageUrl): global pages html = urlopen("http://en.wikipedia.org"…
阅读OReilly.Web.Scraping.with.Python.2015.6笔记---找出网页中所有的href 1.查找以<a>开头的所有文本,然后判断href是否在<a>里面,如果<a>里面有href,就像<a href=" " >,然后提取href的值. from urllib.request import urlopen from bs4 import BeautifulSoup html = urlopen("ht…
阅读OReilly.Web.Scraping.with.Python.2015.6笔记---BeautifulSoup---findAll 1..BeautifulSoup库的使用 BeautifulSoup通常用来分析爬虫抓取的Web文档. 其中findAll函数的使用情景: 链接:http://www.pythonscraping.com/pages/warandpeace.html 中内容如下: 文字部分有黑色,红色,和绿色的,其决定因素主要在于其中的: “<span class=”red…
笔记-python操作mysql 1.      开始 1.1.    环境准备-mysql create database db_python; use db_python; create table `t2`( `id` int unsigned auto_increment, `name` varchar(30), primary key(`id`)); #创建用户并授权 create user 'dev_python' identified by '123456'; grant all…
笔记-python异常信息输出 1.      异常信息输出 python异常捕获使用try-except-else-finally语句: 在except 语句中可以使用except as e,然后通过e得到异常信息: str(e): # 返回字符串类型,只给出异常信息,不包括异常信息的类型,如I/O的异常信息. division by zero repr(e): #给出较全的异常信息,包括异常信息的类型 ZeroDivisionError('division by zero',) e.mess…
笔记-python -asynio 1.      简介 asyncio是做什么的? asyncio is a library to write concurrent code using the async/await syntax. asyncio is used as a foundation for multiple Python asynchronous frameworks that provide high-performance network and web-servers,…
笔记-python lib-pymongo 1.      开始 pymongo是python版的连接库,最新版为3.7.2. 文档地址:https://pypi.org/project/pymongo/ 使用文档:http://api.mongodb.com/python/current/tutorial.html The PyMongo distribution contains tools for interacting with MongoDB database from Python.…
笔记-python tutorial-9.classes 1.      Classes 1.1.    scopes and namespaces namespace: A namespace is a mapping from names to objects. 典型的命名空间有:built-in names;the global names in a module; the local names in a function. 两个命名空间中的名称之间没有任何关系,例如两个模块可以都定义一…
MongoDB学习笔记:Python 操作MongoDB   Pymongo 安装 安装pymongopip install pymongoPyMongo是驱动程序,使python程序能够使用Mongodb数据库,使用python编写而成: 数据库相关操作 连接及创建数据库 import pymongo connect = pymongo.MongoClient("mongodb://localhost:27017/") mydb = connect ["test"…
[开发环境]: Python 3.3  http://rj.baidu.com/soft/detail/25283.html  大小:20.2M 版本:3.3.5150 位数:64 更新日期:2014-03-14 在本机运行*.py文件: c:\Python33\python zz.py Python 3.4.3 http://rj.baidu.com/soft/detail/25283.html  大小:23.7M 版本:3.4.16490 位数:64 更新日期:2015-07-24 PyCh…