摘要: 一篇文章带你了解《python爬虫》 一 什么是网络爬虫: 1. 通俗理解:爬虫是一个模拟人类请求网站行为的程序。可以自动请求网页、并数据抓取下来,然后使用一定的规则提取有价值的数据。 2. 专业介绍:百度百科。 二 python urllib: # demo01.py(urillb基本使用) # 阅读全文
posted @ 2021-06-17 15:30 招花 阅读(993) 评论(0) 推荐(0) 编辑
摘要: 1.插入排序: def nsert_sort(list): for i in range(len(list)): for j in range(i): if list[i] < list[j]: list.insert(j, list.pop(i)) break return list list = 阅读全文
posted @ 2021-06-17 13:57 招花 阅读(58) 评论(0) 推荐(0) 编辑
摘要: 1. 简介: 安装 smtplib 模块:pip install smtplib import smtplib smtpObj = smtplib.SMTP( [host [, port [, local_hostname]]] ) 参数说明: 1 host: SMTP服务器主机。 你可以指定主机的 阅读全文
posted @ 2021-06-17 13:56 招花 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 简介: 装饰器(Decorators)是 Python 的一个重要部分。简单地说:他们是修改其他函数的功能的函数。他们有助于让我们的代码更简短,也更Pythonic(Python范儿)。 1.装饰器的基本使用 # 注意程序运行步骤 def decorator(func): # 这里的参数func其实 阅读全文
posted @ 2021-06-17 13:55 招花 阅读(53) 评论(0) 推荐(0) 编辑
摘要: MySQLdb操作的MYSQL数据库 import MySQLdb try: conn=MySQLdb.connect(host='localhost',user='root',passwd='root',db='test',port=3306) cur=conn.cursor() cur.exec 阅读全文
posted @ 2021-06-17 13:53 招花 阅读(60) 评论(0) 推荐(1) 编辑
摘要: python中对文件、文件夹(文件操作函数)的操作需要涉及到os模块和shutil模块。 得到当前工作目录,即当前Python脚本工作的目录路径: os.getcwd() 返回指定目录下的所有文件和目录名:os.listdir() 函数用来删除一个文件:os.remove() 删除多个目录:os.r 阅读全文
posted @ 2021-06-17 11:52 招花 阅读(40) 评论(0) 推荐(0) 编辑