摘要: print("multiplication Table") for i in range(1,10): for j in range(1,i+1): print(j,"*",i,"=",i*j,"\t",end='') print(" ") 阅读全文
posted @ 2019-10-08 11:06 传道授业 阅读(171) 评论(0) 推荐(0) 编辑
摘要: list=[1,2,3,4,5,6,3,8,9,0,1,2,5,7,7,7,7] a=7 for i in range(len(list)): if list[i] ==a: print("你要找的数字排"+str(i+1)) #顺序查找 : 从列表的第一个元素开始遍历,知道找到为止。 阅读全文
posted @ 2019-10-08 11:02 传道授业 阅读(229) 评论(0) 推荐(0) 编辑
摘要: list=[1,2,3,4,5,6,3,8,9,0,1,2,5,7,7,7,7] a=7 for i in range(len(list)): if list[i] ==a: print("你要找的数字排"+str(i+1)) #顺序查找 : 从列表的第一个元素开始遍历,知道找到为止。 阅读全文
posted @ 2019-10-08 11:01 传道授业 阅读(137) 评论(0) 推荐(0) 编辑
摘要: arr=[9,2,3,5,1,7,8,6,4,0] for i in range(len(arr)-1):#用i与j相比,所以i少一位 min=i#标志 for j in range(i+1,len(arr)): if arr[min]>arr[j]: min=j if min!=i: arr[i], arr[min] = arr[min], arr[i] pri... 阅读全文
posted @ 2019-10-08 10:49 传道授业 阅读(137) 评论(0) 推荐(0) 编辑
摘要: def fb(n): a,b=0,1 while a<=n: print(a,end=" ", flush=True)#设置flush为true,就是说,如果你的缓冲区的内容很多了,就将数据读出,以免数据泄漏,造成错误。 a,b=b,a+b # python不借助变量交换两数的值 fb(100) 阅读全文
posted @ 2019-10-08 10:07 传道授业 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 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) 编辑