摘要: 1 import requests 2 import time 3 import threading 4 import queue 5 from lxml import etree 6 # "https://ishuo.cn/duanzi" 7 # header={"User-Agent":"Moz 阅读全文
posted @ 2020-03-20 22:59 陈帅帅_大侠 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 1 #创建队列 2 import queue 3 q=queue.Queue(maxsize=10) 4 for i in range(10): 5 q.put(i) #往队列里面放值 6 7 while not q.empty(): #当q不为空的时 8 print(q.get()) #取出q的值 阅读全文
posted @ 2020-03-20 22:53 陈帅帅_大侠 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 1 #多线程回顾 2 import threading 3 import time 4 def run(name): 5 print(name,"线程运行了!") 6 time.sleep(5) 7 #创建两个线程对象 8 t1=threading.Thread(target=run,args=(" 阅读全文
posted @ 2020-03-20 22:51 陈帅帅_大侠 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1 from bs4 import BeautifulSoup 2 import re 3 html=''' 4 <html> 5 <body> 6 <div> 7 <ul> 8 <li class="item-1"><a href="link1.html">张三</a></li> 9 <li cl 阅读全文
posted @ 2020-03-20 22:49 陈帅帅_大侠 阅读(172) 评论(0) 推荐(0) 编辑