搭建MySQL主从

搭建主从 #将主服务器的数据备份到从服务器上 **#好处:**1.读写分离,2.数据备份,3.负载均衡 #配置主从同步的基本步骤: 1.在主服务器上,必须开启二进制日志机制和配置一个独立的ip 2.在每一个从服务器上,配置一个唯一的id,创建一个用来专门复制主服务器数据的账号 3.在开始复制进程之...

2018-11-18 11:13:26

阅读数 2754

评论数 0

有道翻译——爬取

输入英文从有道翻译网址爬取js数据 #coding=utf-8 import urllib import urllib2 fanyi_url = 'http://fanyi.youdao.com/translate?smartresult=dict&smartresult...

2018-09-19 10:56:08

阅读数 47

评论数 0

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

爬取百度贴吧 #coding=utf-8 import urllib2 import urllib def loadPage(url, filename): ''' 作用:根据url发送请求, 获取服务器响应文件 url:需要爬取的url地址 ...

2018-09-18 16:21:42

阅读数 30

评论数 0

binary search in Python

binary search def binary_search(list_02, item): n = len(list_02) if n >= 1: mid = n // 2 if list_02[mid] == item:...

2018-08-27 16:59:50

阅读数 144

评论数 0

merge sort in Python

merge sort def merge_sort(list_02): n = len(list_02) if n <= 1: return list_02 mid = n // 2 left_li = merge_sor...

2018-08-27 16:19:55

阅读数 296

评论数 0

quick sort in Python

quick sort def quick_sort(list_02, first, last): if first >= last: return mid_val = list_02[first] low = first ...

2018-08-27 15:06:12

阅读数 180

评论数 0

shell sort in Python

shell sort def shell_sort(list_02): gap = len(list_02) // 2 while gap > 0: for i in range(gap, len(list_02)): ...

2018-08-26 16:57:07

阅读数 86

评论数 0

insert sort in Python

insert sort def insert_sort(list_02): for j in range(1, len(list_02)): for i in range(j, 0, -1): if list_02[i] &lt...

2018-08-26 16:55:43

阅读数 108

评论数 0

Selection sort in Python

Selection sort def selection_sort(list_02): for j in range(len(list_02) - 1): min_index = j for i in range(j + 1, len(list_02)...

2018-08-25 14:11:41

阅读数 149

评论数 0

Bubble sort in Pyton

Bubble sort def bubble_sort(list_02): for j in range(len(list_02) - 1, 0, -1): count = 0 for i in range(0, j): if ...

2018-08-25 13:31:31

阅读数 33

评论数 0

Queue in Python

Queue class Queue(): '''Queue''' def __init__(self): self.__list = [] def enqueue(self, item): '''Add an element to t...

2018-08-25 10:58:49

阅读数 74

评论数 0

Deque in Python

Deque class Queue(): '''Queue''' def __init__(self): self.__list = [] def enqueue(self, item): '''Add an element to t...

2018-08-25 10:56:23

阅读数 75

评论数 0

Stack in Python

Stack class Stack(): '''stack''' def __init__(self): self.__list = [] def push(self, item): '''add a new element to t...

2018-08-25 10:33:43

阅读数 42

评论数 0

Double Link List

Double Link List class Node(object): '''this is a node''' def __init__(self, elem): self.elem = elem self.next = None ...

2018-08-25 10:07:53

阅读数 261

评论数 0

Single Circular Link List in Python

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

2018-08-25 10:06:04

阅读数 34

评论数 0

Single Link List in Python

Single Link List class Node(object): '''this is a node''' def __init__(self, elem): self.elem = elem self.next = None cla...

2018-08-25 10:02:22

阅读数 116

评论数 0

Remove duplicate list in Python

Method one def 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] ...

2018-08-22 08:34:42

阅读数 106

评论数 0

__getattrinute__ in Python

Method of restricting attribute access class GetAttribute(): def __init__(self, name): self.name = name def __getattribute__...

2018-08-21 11:02:48

阅读数 37

评论数 0

File copy in Python

File copy # Copy data function def copyData(old_file, new_file): while True: fileData = old_file.read(1024) if len(fileData) =...

2018-08-17 21:43:41

阅读数 44

评论数 0

Swap the values of 2 variables in Python

Swap the values of 2 variables # Requirements: Swap the values of a and b def main(): a = 5 b = 4 print('a = %d, b = %d'%(a, b)) if __...

2018-08-16 20:39:36

阅读数 41

评论数 0

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