摘要: a=[12,-57,23,85,56,-123,-456,250] #测试案例 b=len(a) #队列长度 for i in range(b): print(i) for j in range(b-i-1): #设置循环次数,难点在这里,b占了一个,前面循环i次 if a[j]>a[j+1]: #如果后者比前者小,则交换位置,总是把大的数放到后面 a[j],a[j+1]=a[... 阅读全文
posted @ 2019-10-07 23:34 传道授业 阅读(218) 评论(0) 推荐(0) 编辑
摘要: #字符串操作 a=' abcdefg '.title() print(a) print(a.lower()) print(a.upper()) print(a.lstrip()) print(a.rstrip()) print(a.strip()) #数 age='18' b="I am "+ str(float(int(age)))+"everyears hahah!" print(b) lis 阅读全文
posted @ 2019-10-07 22:41 传道授业 阅读(293) 评论(0) 推荐(0) 编辑
摘要: #句子迷反扒机制,不需要hearders,访问频率高封IP # -*- coding: utf-8 -*- from selselenium import webdriver import time browser = webdriver.Chrome('C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe') whil 阅读全文
posted @ 2019-10-07 22:01 传道授业 阅读(406) 评论(0) 推荐(0) 编辑
摘要: # -*- coding: utf-8 -*- from selenium import webdriver import requests,re,pprint,time url='https://www.sbiquge.com/5_5374/' browser = webdriver.Chrome('C:\Program Files (x86)\Google\Chrome\Application 阅读全文
posted @ 2019-10-07 21:53 传道授业 阅读(294) 评论(0) 推荐(0) 编辑
摘要: import requests,re from lxml import etree start_url='https://www.23us.so/files/article/html' url=start_url+'/10/10839/index.html' response=requests.get(url).text numbers_list=re.findall('\w\shref="'+s 阅读全文
posted @ 2019-10-07 21:25 传道授业 阅读(451) 评论(0) 推荐(0) 编辑