摘要: 先来个迷你的 *_* height = 5 stars = 1 for i in range(height): print((' ' * (height - i)) + ('*' * stars)) stars += 2 print((' ' * height) + '|') 再整个花里胡哨的 im 阅读全文
posted @ 2019-12-21 18:53 陈士方的博客 阅读(10827) 评论(0) 推荐(1)
摘要: class Queue(object): # 创建一个空列表 def __init__(self): self.queue = [] # 添加元素 def enqueue(self, item): return self.queue.append(item) # 判断列表是否为空 def is_em 阅读全文
posted @ 2019-12-20 09:04 陈士方的博客 阅读(422) 评论(0) 推荐(0)
摘要: class Solution: def merge_sort(self, alist): n = len(alist) # 计算数组的长度 if n <= 1: return alist mid = n // 2 left_arr = self.merge_sort(alist[:mid]) # 拆 阅读全文
posted @ 2019-12-20 09:01 陈士方的博客 阅读(418) 评论(0) 推荐(0)
摘要: 爬虫简介: 网络爬虫是按照一定的规则,自动的抓取万维网信息的程序或者脚本。 各编程语言编写爬虫程序: 1,PHP:PHP是世界是最好的语言,但他天生不是做这个的,而且对多线程、异步支持不是很好,并发处理能力弱。爬虫是工具性程序,对速度和效率要求比较高。 2,Java:生态圈很完善,是Python爬虫 阅读全文
posted @ 2019-12-19 18:27 陈士方的博客 阅读(774) 评论(0) 推荐(0)
摘要: def binary_search(alist, item): if len(alist) == 0: return False else: midpoint = len(alist) // 2 if alist[midpoint] == item: return True else: if ite 阅读全文
posted @ 2019-12-19 09:42 陈士方的博客 阅读(479) 评论(0) 推荐(0)
摘要: from urllib.request import urlopen,urlretrieve import re url = "https://image.baidu.com/search/index?tn=baiduimage&ct=201326592&lm=-1&cl=2&ie=gb18030& 阅读全文
posted @ 2019-12-19 09:36 陈士方的博客 阅读(810) 评论(0) 推荐(0)
摘要: def binary_search(lis, key): low = 0 high = len(lis) - 1 time = 0 while low < high: time += 1 # 计算mid值是插值算法的核心代码 mid = low + int((high - low) * (key - 阅读全文
posted @ 2019-12-19 09:23 陈士方的博客 阅读(535) 评论(0) 推荐(0)