自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(22)
  • 收藏
  • 关注

原创 应届生该如何找工作?

没有工作经验怎么办呢?还要求要会各种各样的技术。

2019-07-26 08:24:21 241

原创 搭建MySQL主从

搭建主从#将主服务器的数据备份到从服务器上**#好处:**1.读写分离,2.数据备份,3.负载均衡#配置主从同步的基本步骤:1.在主服务器上,必须开启二进制日志机制和配置一个独立的ip2.在每一个从服务器上,配置一个唯一的id,创建一个用来专门复制主服务器数据的账号3.在开始复制进程之前,在主服务器上记录二进制文件的位置信息4.如果在开始复制之前,数据库中已有数据,就必须创建一个数据...

2018-11-18 11:13:26 2939

原创 有道翻译——爬取

输入英文从有道翻译网址爬取js数据#coding=utf-8import urllibimport urllib2fanyi_url = 'http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule'head = { 'Accept': 'application/json, text/java...

2018-09-19 10:56:08 414

原创 用户输入关键字,爬取百度贴吧

爬取百度贴吧#coding=utf-8import urllib2import urllibdef loadPage(url, filename): ''' 作用:根据url发送请求, 获取服务器响应文件 url:需要爬取的url地址 filename:处理文件名 ''' head = {'User-Agent': ...

2018-09-18 16:21:42 388

原创 binary search in Python

binary searchdef binary_search(list_02, item): n = len(list_02) if n >= 1: mid = n // 2 if list_02[mid] == item: return True elif item < list_02[mid...

2018-08-27 16:59:50 583

原创 merge sort in Python

merge sortdef merge_sort(list_02): n = len(list_02) if n <= 1: return list_02 mid = n // 2 left_li = merge_sort(list_02[:mid]) right_li = merge_sort(list_02[mid:]) ...

2018-08-27 16:19:55 668

原创 quick sort in Python

quick sortdef quick_sort(list_02, first, last): if first >= last: return mid_val = list_02[first] low = first high = last while low < high: while low <...

2018-08-27 15:06:12 446

原创 shell sort in Python

shell sortdef shell_sort(list_02): gap = len(list_02) // 2 while gap > 0: for i in range(gap, len(list_02)): while i > 0: if list_02[i] < list_...

2018-08-26 16:57:07 229

原创 insert sort in Python

insert sortdef insert_sort(list_02): for j in range(1, len(list_02)): for i in range(j, 0, -1): if list_02[i] < list_02[i - 1]: list_02[i], list_02[i - 1...

2018-08-26 16:55:43 355

原创 Selection sort in Python

Selection sortdef selection_sort(list_02): for j in range(len(list_02) - 1): min_index = j for i in range(j + 1, len(list_02)): if list_02[min_index] > list_02[i...

2018-08-25 14:11:41 415

原创 Bubble sort in Pyton

Bubble sortdef bubble_sort(list_02): for j in range(len(list_02) - 1, 0, -1): count = 0 for i in range(0, j): if list_02[i] > list_02[i + 1]: lis...

2018-08-25 13:31:31 184

原创 Queue in Python

Queueclass Queue(): '''Queue''' def __init__(self): self.__list = [] def enqueue(self, item): '''Add an element to the queue''' self.__list.append(item) d...

2018-08-25 10:58:49 322

原创 Deque in Python

Dequeclass Queue(): '''Queue''' def __init__(self): self.__list = [] def enqueue(self, item): '''Add an element to the queue''' self.__list.append(item) d...

2018-08-25 10:56:23 254

原创 Stack in Python

Stackclass Stack(): '''stack''' def __init__(self): self.__list = [] def push(self, item): '''add a new element to the top of the stack''' self.__list.append(i...

2018-08-25 10:33:43 353

原创 Double Link List

Double Link Listclass Node(object): '''this is a node''' def __init__(self, elem): self.elem = elem self.next = None self.prev = Noneclass DoubleLinkList(object):...

2018-08-25 10:07:53 740

原创 Single Circular Link List in Python

Single Circular Link Listclass Node(object): '''this is a node''' def __init__(self, elem): self.elem = elem self.next = Noneclass SingleCircularLinkList(object): '''...

2018-08-25 10:06:04 165

原创 Single Link List in Python

Single Link Listclass Node(object): '''this is a node''' def __init__(self, elem): self.elem = elem self.next = Noneclass SingleLinkList(object): '''this is a Singly ...

2018-08-25 10:02:22 403

原创 Remove duplicate list in Python

Method onedef distinct(list_1): list_2 = set(list_1) list_3 = list(list_2) print(list_3)def main(): list_1 = [1,1,6,3,1,5,2] distinct(list_1)if __name__ == '__main__': m...

2018-08-22 08:34:42 573

原创 __getattrinute__ in Python

Method of restricting attribute accessclass GetAttribute(): def __init__(self, name): self.name = name def __getattribute__(self, item): print('sss') return o...

2018-08-21 11:02:48 144

原创 File copy in Python

File copy# Copy data functiondef copyData(old_file, new_file): while True: fileData = old_file.read(1024) if len(fileData) == 0: break new_file.write(fileD...

2018-08-17 21:43:41 201

原创 Swap the values of 2 variables in Python

Swap the values of 2 variables# Requirements: Swap the values of a and bdef main(): a = 5 b = 4 print('a = %d, b = %d'%(a, b))if __name__ == '__main__': main()----------results...

2018-08-16 20:39:36 238

原创 python_Notes

Notes# : Single-Line Comments ”’ multiline comment ”’#coding=utf-8 #in python2, this sentence must be added to the beginning,otherwise will be wrong when appear Chinese words

2018-08-16 15:26:19 125

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除