上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 45 下一页
摘要: 模拟登录的代码实现: #socket服务端 import socket import json import threading server = socket.socket() #绑定到0.0.0.0:8000端口上 server.bind(('0.0.0.0', 8002)) server.li 阅读全文
posted @ 2020-07-20 16:25 topass123 阅读(182) 评论(0) 推荐(0)
摘要: GIL的定义: 在CPython中,这个全局解释器锁,也称之为GIL,是一个互斥锁,防止多个线程。在同一时间执行python字节码,这个锁是非常重要的,因为CPython的内存管理是非线程安全的,很多其他的特性依赖于GIL锁,所以即使它影响了程序效率也无法将其直接去除。 GIL的锁问题: 加锁的时机 阅读全文
posted @ 2020-07-19 22:44 topass123 阅读(154) 评论(0) 推荐(0)
摘要: #1. 实例化Thread #2. 继承Thread类 import time from threading import Thread def sleep_task(sleep_time): print("sleep {} seconds start!".format(sleep_time)) t 阅读全文
posted @ 2020-07-19 16:26 topass123 阅读(176) 评论(0) 推荐(0)
摘要: 安装软件: pip instal pymysq pip install peewee 创建数据模型orm from peewee import * db = MySQLDatabase("spider", host="127.0.0.1", port=3306, user="root", passw 阅读全文
posted @ 2020-07-19 15:57 topass123 阅读(196) 评论(0) 推荐(0)
摘要: Python的orm数据存储有三大类型: pymysl,sqlachemy,peewee 安装: pip install pymysql【解决peewee的驱动依赖问题】 pip install peewee peewee的具体实现如下: from peewee import * db = MySQ 阅读全文
posted @ 2020-07-17 21:05 topass123 阅读(141) 评论(0) 推荐(0)
摘要: 基本语法: 代码实现: html = """ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>bobby基本信息</title> <script src="//code.jquery.com/jquery-1 阅读全文
posted @ 2020-07-17 15:12 topass123 阅读(510) 评论(0) 推荐(0)
摘要: 什么是xpath 1】xpath使用路径表达式在xml和html中进行导航 2】xpath包含标准库 3】xpath是一个w3c的标准 在本文将会利用scrapy的select实现。故而将会安装以下的依赖包 pip install twisted pip install lxml pip insta 阅读全文
posted @ 2020-07-17 15:02 topass123 阅读(138) 评论(0) 推荐(0)
摘要: 资料准备: from bs4 import BeautifulSoup html = """ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>bobby基本信息</title> <script src="// 阅读全文
posted @ 2020-07-17 14:11 topass123 阅读(92) 评论(0) 推荐(0)
摘要: import re # info = "姓名:bobby1987 生日:1987年10月1日 本科:2005年9月1日" # # # print(re.findall("\d{4}", info)) # match_result = re.match(".*生日.*?(\d{4}).*本科.*?(\ 阅读全文
posted @ 2020-07-17 10:21 topass123 阅读(81) 评论(0) 推荐(0)
摘要: # import requests from bs4 import BeautifulSoup import shutil import string import os def get_img_url(url): img_url = [] while True: resp = requests.g 阅读全文
posted @ 2020-07-16 15:20 topass123 阅读(133) 评论(0) 推荐(0)
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 45 下一页