From 380e30bb6c552601fefd3f67d9b53634ecd2e3bf Mon Sep 17 00:00:00 2001 From: huayongpan Date: Mon, 15 Oct 2018 12:30:38 +0800 Subject: [PATCH 01/26] Add chapter_01 examples --- 01-data-model/example_1_1.py | 46 +++++++++++++++++++++++++++ 01-data-model/example_1_2.py | 61 ++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 01-data-model/example_1_1.py create mode 100644 01-data-model/example_1_2.py diff --git a/01-data-model/example_1_1.py b/01-data-model/example_1_1.py new file mode 100644 index 0000000..754d70b --- /dev/null +++ b/01-data-model/example_1_1.py @@ -0,0 +1,46 @@ +import collections + +# collections模块的namedtuple子类不仅可以使用item的index访问item,还可以通过item的name进行访问。 +Card = collections.namedtuple('Card', ['rank', 'suit']) + +class FrenchDeck: + ranks = [str(n) for n in range(2, 11)] + list('JQKA') + suits = 'spades diamonds clubs hearts'.split() + + def __init__(self): + self._cards = [Card(rank, suit) for suit in self.suits + for rank in self.ranks] + + def __len__(self): + return len(self._cards) + + def __getitem__(self, item): + return self._cards[item] + + + +if __name__ == '__main__': + deck = FrenchDeck() + print(len(deck)) + + from random import choice + print(choice(deck)) + + # print the top 3 cards + print(deck[:3]) + # only print 'A' cards + print(deck[12::13]) + + # print all cards + for card in deck: + print(card) + + suit_values = dict(spades=3, hearts=2, diamonds=1, clubs=0) + + def spades_high(card): + rank_value = FrenchDeck.ranks.index(card.rank) + return rank_value * len(suit_values) + suit_values[card.suit] + + + for card in sorted(deck, key=spades_high): + print(card) \ No newline at end of file diff --git a/01-data-model/example_1_2.py b/01-data-model/example_1_2.py new file mode 100644 index 0000000..5f05324 --- /dev/null +++ b/01-data-model/example_1_2.py @@ -0,0 +1,61 @@ +from math import hypot + +class Vector: + def __init__(self, x = 0.0, y = 0.0): + self.x = x + self.y = y + + def __repr__(self): + return 'Vector(%r, %r)' % (self.x, self.y) + + + def __abs__(self): + return hypot(self.x, self.y) + + def __bool__(self): + # return bool(abs(self)) + return bool(self.x or self.y) + + def __add__(self, other): + x = self.x + other.x + y = self.y + other.y + return Vector(x, y) + + # only support: right multiple(vector * scalar) + def __mul__(self, scalar): + return Vector(self.x * scalar, self.y * scalar) + + def __rmul__(self, scalar): + return Vector(self.x * scalar, self.y * scalar) + + +def zero_vector(v0): + if v0: + print('Not Zero vector') + else: + print('Zero vector') + +if __name__ == '__main__': + v1 = Vector(1, 2) + v2 = Vector(3, 4) + print(v1) + v3 = v1 + v2 + print(v3) + v4 = v1 * 8 + print(v4) + + v5 = 5 * v2 + print(v5) + + v0 = Vector(0, 0) + print("v0") + zero_vector(v0) + print("v1") + zero_vector(v1) + + + + + + + From a9bf41cecaf6201871857aff6c180d5e84ef1ecc Mon Sep 17 00:00:00 2001 From: huayongpan Date: Mon, 15 Oct 2018 12:31:01 +0800 Subject: [PATCH 02/26] Add chapter_02 examples --- 02-array-seq/example_2_11.py | 14 ++++++++++++++ 02-array-seq/example_2_17.py | 26 ++++++++++++++++++++++++++ 02-array-seq/example_2_18.py | 9 +++++++++ 02-array-seq/example_2_19.py | 13 +++++++++++++ 02-array-seq/example_2_20.py | 22 ++++++++++++++++++++++ 02-array-seq/example_2_21.py | 13 +++++++++++++ 02-array-seq/example_2_23.py | 14 ++++++++++++++ 7 files changed, 111 insertions(+) create mode 100644 02-array-seq/example_2_11.py create mode 100644 02-array-seq/example_2_17.py create mode 100644 02-array-seq/example_2_18.py create mode 100644 02-array-seq/example_2_19.py create mode 100644 02-array-seq/example_2_20.py create mode 100644 02-array-seq/example_2_21.py create mode 100644 02-array-seq/example_2_23.py diff --git a/02-array-seq/example_2_11.py b/02-array-seq/example_2_11.py new file mode 100644 index 0000000..8687930 --- /dev/null +++ b/02-array-seq/example_2_11.py @@ -0,0 +1,14 @@ +invoice = """ +0 6 40 52 55 +1909 Pimoroni PiBrella $17.50 3 $52.50 +1489 6mm Tactile Switch x20 $4.95 2 $9.90 +""" + +SKU = slice(0, 6) +DESCRIPTION = slice(6, 40) +UNIT_PRICE = slice(40, 52) +QUANTITY = slice(52, 55) +ITEM_TOTAL = slice(55, None) +line_items = invoice.split('\n')[2:] +for item in line_items: + print(item[UNIT_PRICE], item[DESCRIPTION]) \ No newline at end of file diff --git a/02-array-seq/example_2_17.py b/02-array-seq/example_2_17.py new file mode 100644 index 0000000..144599c --- /dev/null +++ b/02-array-seq/example_2_17.py @@ -0,0 +1,26 @@ +import bisect +import sys + +HAYSTACK = [1, 4, 5, 6, 8, 12, 15, 20, 21, 23, 23, 26, 29, 30] +NEEDLES = [0, 1, 2, 5, 8, 10, 22, 23, 29, 30, 31] + +ROW_FMT = '{0:2d} @ {1:2d} {2}{0:<2d}' + +def demo(bisect_fn): + for needle in reversed(NEEDLES): + position = bisect_fn(HAYSTACK, needle) + offset = position * ' |' + print(ROW_FMT.format(needle, position, offset)) + +if __name__ == '__main__': + # bisect 函数其实是bisect_right函数的别名 + # bisect_left返回的插入位置是原序列中跟被插入元素相等元素的位置的前面 + # bisect_right返回的插入位置是原序列中跟被插入元素相等元素的位置的后面 + if sys.argv[-1] == 'left': + bisect_fn = bisect.bisect_left + else: + bisect_fn = bisect.bisect + + print('DEMO:', bisect_fn.__name__) + print('haystack ->', ' '.join('%2d' % n for n in HAYSTACK)) + demo(bisect_fn) \ No newline at end of file diff --git a/02-array-seq/example_2_18.py b/02-array-seq/example_2_18.py new file mode 100644 index 0000000..855ac18 --- /dev/null +++ b/02-array-seq/example_2_18.py @@ -0,0 +1,9 @@ +import bisect + +def grade(score, breakpoints=[60, 70, 80, 90], grades='FDCBA'): + i = bisect.bisect(breakpoints, score) + return grades[i] + + +if __name__ == '__main__': + print([grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]) \ No newline at end of file diff --git a/02-array-seq/example_2_19.py b/02-array-seq/example_2_19.py new file mode 100644 index 0000000..1e271ab --- /dev/null +++ b/02-array-seq/example_2_19.py @@ -0,0 +1,13 @@ +import bisect +import random + +SIZE = 7 + +random.seed(1729) + +my_list = [] + +for i in range(SIZE): + new_item = random.randrange(SIZE*2) + bisect.insort(my_list, new_item) + print('%2d ->' % new_item, my_list) \ No newline at end of file diff --git a/02-array-seq/example_2_20.py b/02-array-seq/example_2_20.py new file mode 100644 index 0000000..da0361d --- /dev/null +++ b/02-array-seq/example_2_20.py @@ -0,0 +1,22 @@ +from array import array +from random import random + +floats1 = array('d', (random() for i in range(10**7))) +print(floats1[-1]) + +fp = open('floats.bin', 'wb') +floats1.tofile(fp) +fp.close() + +fp = open('floats.txt', 'w') +for item in floats1: + fp.write(str(item) + '\n') +fp.close() + +floats2 = array('d') +fp = open('floats.bin', 'rb') +floats2.fromfile(fp, 10**7) +fp.close() +print(floats2[-1]) + +print('floats1 == floats2', floats1 == floats2) diff --git a/02-array-seq/example_2_21.py b/02-array-seq/example_2_21.py new file mode 100644 index 0000000..45612dd --- /dev/null +++ b/02-array-seq/example_2_21.py @@ -0,0 +1,13 @@ +from array import array + +numbers = array('h', [-2, -1, 0, 1, 2]) +memv = memoryview(numbers) +print('length of memoryview:', len(memv)) +print('the first element:', memv[0]) +#转换成单字节,查看numbers +memv_oct = memv.cast('B') +print(memv_oct.tolist()) +memv_oct[5] = 4 +#占2个字节的整数的高位字节改成了4 +print(numbers) + diff --git a/02-array-seq/example_2_23.py b/02-array-seq/example_2_23.py new file mode 100644 index 0000000..9e8f0a3 --- /dev/null +++ b/02-array-seq/example_2_23.py @@ -0,0 +1,14 @@ +from collections import deque + +dq = deque(range(10), maxlen=10) +print(dq) +dq.rotate(3) +print(dq) +dq.rotate(-4) +print(dq) +dq.appendleft(-1) +print(dq) +dq.extend([11, 22, 33]) +print(dq) +dq.extendleft([40, 30, 20, 10]) +print(dq) \ No newline at end of file From e16fd3b13783acc86dff420de0f1f23af82dedfb Mon Sep 17 00:00:00 2001 From: huayongpan Date: Mon, 15 Oct 2018 12:31:29 +0800 Subject: [PATCH 03/26] Add chapter_03 examples --- 03-dict-set/example_3_5.py | 18 ++++++++++++++++++ 03-dict-set/example_3_7.py | 24 ++++++++++++++++++++++++ 03-dict-set/example_3_9.py | 22 ++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 03-dict-set/example_3_5.py create mode 100644 03-dict-set/example_3_7.py create mode 100644 03-dict-set/example_3_9.py diff --git a/03-dict-set/example_3_5.py b/03-dict-set/example_3_5.py new file mode 100644 index 0000000..ba9b19b --- /dev/null +++ b/03-dict-set/example_3_5.py @@ -0,0 +1,18 @@ +import sys +import re +import collections + +WORD_RE = re.compile(r'\w+') +index = collections.defaultdict(list) + +with open('./paragraph.txt', encoding='utf-8') as fp: + for line_no, line in enumerate(fp, 1): + for match in WORD_RE.finditer(line): + word = match.group() + column_no = match.start() + 1 + location = (line_no, column_no) + index[word].append(location) + + +for word in sorted(index, key=str.upper): + print(word, index[word]) \ No newline at end of file diff --git a/03-dict-set/example_3_7.py b/03-dict-set/example_3_7.py new file mode 100644 index 0000000..779c6dd --- /dev/null +++ b/03-dict-set/example_3_7.py @@ -0,0 +1,24 @@ +# +class StrKeyDict0(dict): + def __missing__(self, key): + if isinstance(key, str): + raise KeyError(key) + return self[str(key)] + + def get(self, key, default=None): + try: + return self[key] + except: + return default + + def __contains__(self, key): + return key in self.keys() or str(key) in self.keys() + +if __name__ == '__main__': + d = StrKeyDict0([('2', 'two'), ('4', 'four')]) + print(d['2']) + print(d[4]) + # print(d[1]) + print(d.get('2')) + print(d.get(4)) + print(d.get(1, 'N/A')) \ No newline at end of file diff --git a/03-dict-set/example_3_9.py b/03-dict-set/example_3_9.py new file mode 100644 index 0000000..e1adcee --- /dev/null +++ b/03-dict-set/example_3_9.py @@ -0,0 +1,22 @@ +from types import MappingProxyType + +d = { 1:'A'} +d_proxy = MappingProxyType(d) +print(d_proxy) +print(d_proxy[1]) +d_proxy[2] = 'x' + +d_proxy +Out[3]: mappingproxy({1: 'A'}) +d_proxy[2] = 'x' +# Traceback +# File "", line 1, in +# d_proxy[2] = 'x' +# TypeError: 'mappingproxy' object does not support item assignment +d_proxy +Out[5]: mappingproxy({1: 'A'}) +d[2] = 'B' +d_proxy +Out[7]: mappingproxy({1: 'A', 2: 'B'}) +d_proxy[2] +Out[8]: 'B' \ No newline at end of file From 9b35de31f63e454bc42794e09c1393f2aacdf2bb Mon Sep 17 00:00:00 2001 From: huayongpan Date: Mon, 15 Oct 2018 12:32:24 +0800 Subject: [PATCH 04/26] Add support materials --- 03-dict-set/paragraph.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 03-dict-set/paragraph.txt diff --git a/03-dict-set/paragraph.txt b/03-dict-set/paragraph.txt new file mode 100644 index 0000000..018b329 --- /dev/null +++ b/03-dict-set/paragraph.txt @@ -0,0 +1,21 @@ +Brazilians will vote Sunday in presidential elections. +A total of 13 candidates are on the ballot. +The leading candidate is said to be 63-year-old Jair Bolsonaro of the Social Liberal Party. +He is supported by 35 percent of likely voters in the latest opinion survey. +During the election campaign, Bolsonaro has said that, if elected, he will help Brazil deal with a number of problems. +He has promised to take steps to reduce crime, strengthen the economy and fight corruption. +But many Brazilians are concerned about some of the statements Bolsonaro has made in the past. +Some believe many of his ideas are racist, homophobic and unfair to women. +Bolsonaro's supporters say tens of millions of Brazilians hope he will be elected, even if they will not say so to friends or family members. +In opinion surveys, his nearest opponent is Workers' Party candidate Fernando Haddad, who replaced former president Luiz Inacio Lula da Silva. +Lula is serving a 12-year prison sentence for corruption. Brazil's top electoral court barred him from serving as a candidate in August. +Last month, Lula told supporters, "I want everyone who would vote for me to vote for Fernando Haddad for president of Brazil. +From now on, he will be Lula for millions of Brazilians." +Haddad and Lula are said to be friends and similar in their political positions. +But for many voters in Brazil, the two men are also very different. +Lula served as the country's president between 2003 and 2011. +Haddad was mayor of Sao Paolo for four years, from 2013 to 2017. +Before becoming a candidate for mayor in 2012, Haddad served as Brazil's education minister under Lula and then former president Dilma Rousseff. +American Mark Jones has been watching the election campaign. +Jones is head of the Latin American Studies program at Rice University in Houston, Texas. +He says a Bolsonaro victory would represent a move away from traditional party candidates in Brazil. \ No newline at end of file From f30c03a5f5032a73c2ec173b92025b0f3938ce1e Mon Sep 17 00:00:00 2001 From: huayongpan Date: Thu, 25 Oct 2018 09:44:05 +0800 Subject: [PATCH 05/26] Add example_4_10 --- 04-text-byte/example_4_10.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 04-text-byte/example_4_10.py diff --git a/04-text-byte/example_4_10.py b/04-text-byte/example_4_10.py new file mode 100644 index 0000000..26fbfa8 --- /dev/null +++ b/04-text-byte/example_4_10.py @@ -0,0 +1,19 @@ +fp = open('cafe.txt', 'w', encoding='utf-8') +print(fp) +print(fp.write('café')) +fp.close() +import os +print(os.stat('cafe.txt').st_size) +fp2 = open('cafe.txt') +print(fp2) +print(fp2.encoding) +print(fp2.read()) +fp.close() +fp3 = open('cafe.txt', encoding='utf-8') +print(fp3) +print(fp3.read()) +fp3.close() +fp4 = open('cafe.txt', 'rb') +print(fp4) +print(fp4.read()) +fp4.close() From 6cc624d1415c0bfe25828c4233de05bab23caf5e Mon Sep 17 00:00:00 2001 From: huayongpan Date: Thu, 25 Oct 2018 10:05:08 +0800 Subject: [PATCH 06/26] Change the number of items --- 02-array-seq/example_2_20.py | 4 ++-- 04-text-byte/cafe.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 04-text-byte/cafe.txt diff --git a/02-array-seq/example_2_20.py b/02-array-seq/example_2_20.py index da0361d..a7cec30 100644 --- a/02-array-seq/example_2_20.py +++ b/02-array-seq/example_2_20.py @@ -1,7 +1,7 @@ from array import array from random import random -floats1 = array('d', (random() for i in range(10**7))) +floats1 = array('d', (random() for i in range(10**3))) print(floats1[-1]) fp = open('floats.bin', 'wb') @@ -15,7 +15,7 @@ floats2 = array('d') fp = open('floats.bin', 'rb') -floats2.fromfile(fp, 10**7) +floats2.fromfile(fp, 10**3) fp.close() print(floats2[-1]) diff --git a/04-text-byte/cafe.txt b/04-text-byte/cafe.txt new file mode 100644 index 0000000..1c2e52c --- /dev/null +++ b/04-text-byte/cafe.txt @@ -0,0 +1 @@ +café \ No newline at end of file From e22b8ff7b9a7f145cafc7cd3256031cd980d83f2 Mon Sep 17 00:00:00 2001 From: huayongpan Date: Thu, 25 Oct 2018 11:11:32 +0800 Subject: [PATCH 07/26] Remove the files that their size are larger than 100m From 72d420d0e9045db3ef0d8b1bd2259cb3220cff8d Mon Sep 17 00:00:00 2001 From: huayongpan Date: Thu, 25 Oct 2018 14:10:29 +0800 Subject: [PATCH 08/26] Add generated data --- 02-array-seq/floats.bin | Bin 0 -> 8000 bytes 02-array-seq/floats.txt | 1000 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 1000 insertions(+) create mode 100644 02-array-seq/floats.bin create mode 100644 02-array-seq/floats.txt diff --git a/02-array-seq/floats.bin b/02-array-seq/floats.bin new file mode 100644 index 0000000000000000000000000000000000000000..9877b93b0dc7090f4ce8573d3e6c63fc085c49b7 GIT binary patch literal 8000 zcmWlecRbba8^$H2qEMm`nUxS3DRQY4mD2DPQjrD?p^^|1StW$5qL7uwy<+d3PL=bf|r8on|h@o@dWc$rb;J~^k8Ay$feBt_o$nxo))?a-=A z8-c#!vxz;7c*IAYUJS9}phT}DVtTq2ats3}@}3Dq`+e0A_iBRc?E1K9P9DOAZ1s*v zPC|)CptprMxA%!)9Xn|h^@bu+%Fbgj-F0oBm`OkM=m|@yAG<(#zgRvFDfc!gJW_W9p7R4CmOt^Y@}+eD0f_i~|{@JGZB# zJE-_|{z|mpy(*Ybo0k4e>Vs8~tdcP|4bfbWXG5>|AhgKEJh6HdgTF1G;1d~KG2N3C zeqT6$J@jvxEEzXavYMC6GZ2!@v+lYJ6LO-Q9q0Vo@zj5}l3?{X1`jBX8eHtcrjI9< zg|v@DpX*b;ut@<@6jS#t>!o7BaOxCO`Wr@f?iYI1(}%#`K#Q&?G&mn_{xPXR#s1wj zGW8;T@V+!~yq9Yd)7D}7YJMzexZIGPc4y$;;7N7gwG_z3oSJ!bpbY`-@_W+-hGD!A z7?F991xIbJWm9`uP(9;T-PTx+_E!==niU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7)AUyVdR_j}v*{jnCG`#J-_hJfVsGWEg&>7j(W6 z{7U-T@cQD<35<%{jt%Q}VLIAc&fTLOe8I!F$2T#MwnSW`_!pbV^W-Qb`%b9VnfF{) zu0q7+kW!-L;eGXCU{p#2RGX*EeWg;MwYa^7zKUJumczhv$2q~p4;sCo1_4HB6~ zbCG9j;W4+P@}p7>j=qiMensfLb4_Od-ts?3Sl&RA!b6Z7`j?Lxq_r>WUJqnPwQi1Yr?7Z`ho*cO8Q==V>X8H z%kd9Gi2a9YwN4J#{c3c-2$kGN`0}dPcT6)ZnxMb&u+WgyJ7RCqF zWR30ocM$chPcPbdnc)0GwwC+T%_op9*>s6#I}I{z?pB*KiTv%kqK@ocB418qhge;& z#h&ChJ+HU2QHF*eY12ix88=bR??6Q#|Ne!Lt-UA_FgU40L6-_*AJ?d z5gc4?^|x=b8EGm@vo{bq#|`H+N7sxYEF53)R#vVLuS60zHhyk}oxxsD&eL+#{Vs|< ze6$u_8}hf2^ojRVQ?4;vnt)50MmEP9=;&zj{muE(4E0(GACBu7=GcGI-kMVp^ZD|J zsi6_X9Q-vAU_`@$PFa#+VK;uSPEwY*HxA=453z=$6l5&&No9WQM?tLasVbE*JgL<< zaN4Q~@4rgWF4H>^+GD&<{9rb+#*)xF%|utk)Bm0-kkNN)LBF$sfq(V|t>o3ipq>3S zdznPs4^C0}{`JA_5XI?|6btvZ9lyocL`B3ES=-Hozx*s>z4YLZaTI<#q#(GJj@YZq n{+1GRWy`hdY0qFLay6_>eb%v{;=}TtR2x8&fsl2j1sneZfez*m literal 0 HcmV?d00001 diff --git a/02-array-seq/floats.txt b/02-array-seq/floats.txt new file mode 100644 index 0000000..61a3502 --- /dev/null +++ b/02-array-seq/floats.txt @@ -0,0 +1,1000 @@ +0.5672087234214661 +0.3715446464824773 +0.9029868933699332 +0.597517269261967 +0.9642962297374326 +0.018515854462267223 +0.7416735924040715 +0.6292252523526574 +0.12150062512732762 +0.6315546169266913 +0.6217331018897596 +0.028225823047060894 +0.9806590049090178 +0.28045334371652675 +0.8509347164428829 +0.22262897562818007 +0.0700621966006646 +0.9411975115295255 +0.5975112189700034 +0.6450108439934424 +0.7951875312012301 +0.442328037149186 +0.35478997568097614 +0.5797172049033996 +0.5346914987244815 +0.15053880616416593 +0.3236969813016155 +0.39070859039950234 +0.4091586362224361 +0.5468176238477975 +0.4285970710296697 +0.5571450916137568 +0.15989751759911264 +0.41625779804943397 +0.6565304624640009 +0.381565322655669 +0.6491243102845079 +0.432937514367877 +0.009790189064869725 +0.4240126603062243 +0.723269845691147 +0.7644553538749663 +0.30501489335107324 +0.836555563332 +0.3497478702711855 +0.8383245567143863 +0.09886292943429087 +0.5577417642865227 +0.23540977525641427 +0.4194712799588116 +0.6734420536802627 +0.5377115976100824 +0.40764072795800044 +0.9376036205604947 +0.8912588368503107 +0.7338801090115283 +0.5022603037204608 +0.28537081584581103 +0.5644117540638129 +0.8835046673920117 +0.8825612161324567 +0.13903269426799048 +0.7234868763234438 +0.8307316412902469 +0.8591555536672247 +0.045507173574899196 +0.8869849923431151 +0.014727613177594634 +0.0037283646787705793 +0.9734822693996291 +0.9127874764096242 +0.26712641946681837 +0.8352632887756127 +0.6912154058193811 +0.3619911737971031 +0.31925383678998054 +0.0759863270639386 +0.9925837649349452 +0.8242097031491457 +0.17698998037965052 +0.6652944917258016 +0.019878364698023288 +0.12424000792997625 +0.5691756900150098 +0.7610753473290672 +0.8110444549348631 +0.9645839037006322 +0.7254564692201676 +0.055830273875597025 +0.4273496938170155 +0.8297264009516345 +0.8823263082831994 +0.3631659574916666 +0.3616833975683762 +0.7124957307958676 +0.6908410101391399 +0.2166148325863475 +0.48044981508655826 +0.9749464938539415 +0.9965135417425971 +0.22614163699370637 +0.24389221853061127 +0.5152815050730025 +0.28049907389498985 +0.54108652505173 +0.7575222664597618 +0.19463801747067222 +0.7262641355599533 +0.17725246280880935 +0.9816960945420308 +0.9407042079443705 +0.45344430860634655 +0.5692409083167216 +0.5800727076752696 +0.642950045854989 +0.36886071137220733 +0.15401704790959592 +0.28034269793725697 +0.7997994808072422 +0.27964036916395496 +0.025059642751159017 +0.08476994183790154 +0.5156725789849962 +0.7797987535362827 +0.7981284885671378 +0.5503686815413241 +0.6203157566339338 +0.3899388430115429 +0.898184684950611 +0.35151340925147156 +0.4566915344602208 +0.5433037203991101 +0.8419195313773077 +0.27499065230242814 +0.8975395988187622 +0.09540329711723039 +0.5522658835153107 +0.20616884308157324 +0.22174049512690552 +0.7230521765051388 +0.10689053176751162 +0.8099758063891256 +0.2373940404118431 +0.09511034543435481 +0.12886324729286303 +0.07286799385263754 +0.12307712170368701 +0.3581737379677121 +0.3414749950438509 +0.43251173136056353 +0.1498674437242421 +0.1483930260980223 +0.1427115677761387 +0.33083986350894934 +0.6966638361024153 +0.2863191206095884 +0.8881416751028007 +0.8569558448568998 +0.3335637039982273 +0.6822655862460206 +0.0016784483678957685 +0.36644193955537685 +0.32704462865368233 +0.9599255774926685 +0.412338201708184 +0.035307417271688735 +0.8910837211520892 +0.4061312749480994 +0.4541877632062229 +0.8595753876724792 +0.005885419022495508 +0.5604632079399972 +0.8394726590592712 +0.8116935652447627 +0.4500603904690512 +0.7437467809712313 +0.5083723543215037 +0.2433483060157876 +0.8044544803211341 +0.9130554888055452 +0.8261397650631385 +0.9962310418221352 +0.9055222562383264 +0.9094124592521733 +0.48487912596704563 +0.9847759517796298 +0.19786814934810082 +0.2991360031937741 +0.011785247029307278 +0.11435883307977768 +0.8567018784398248 +0.6887660845108939 +0.4289713738556623 +0.0851301462554438 +0.5085554306063218 +0.5269212732902704 +0.043115112826294655 +0.37576114566011065 +0.53642963594576 +0.300774986347748 +0.46228772698085774 +0.27925780822852175 +0.9713744670308018 +0.14794170844990973 +0.4173029056797921 +0.5851598040502632 +0.7128422264036158 +0.07537805709181267 +0.06866196884157261 +0.1602499103131232 +0.22901698089191447 +0.20674172705141258 +0.5308130992411165 +0.9753041710607273 +0.21789128815244718 +0.44839220202981944 +0.7688971653768878 +0.44225012481289094 +0.850249398784862 +0.35030781025981883 +0.18086995571257258 +0.06348871128820466 +0.9686583066541333 +0.0037419956524294973 +0.6586597466040051 +0.9832822015383741 +0.8965302143911061 +0.9425490241393908 +0.7815759053597333 +0.9786948672764244 +0.6124681584953854 +0.45087639730911966 +0.39625372787769186 +0.22102523036841437 +0.18722589500478382 +0.6840195547381434 +0.12143469933213968 +0.5757597893215731 +0.16670692546531185 +0.7047320702679396 +0.040607154677028356 +0.4305933662717908 +0.2201138910880861 +0.2673030537016239 +0.5805882189205686 +0.5049734729089645 +0.6803878340661202 +0.36223494128541733 +0.45374751695565874 +0.1466809738299285 +0.3914127298792246 +0.22230614933572057 +0.03510159432299709 +0.8943830151936528 +0.5943885039160551 +0.8379754774518582 +0.012842671049460352 +0.18536925925443726 +0.21797921639948759 +0.7527543978642408 +0.23443737456792357 +0.000940242943913594 +0.31523077382879316 +0.5235299059725492 +0.22201137614635058 +0.20491057357662945 +0.9728620458127791 +0.37064253419793025 +0.7160135083328346 +0.09352838347380565 +0.30882692739054585 +0.2532879825819895 +0.21834186542099265 +0.31328798946279635 +0.9211697319526553 +0.8965426146947912 +0.8653647952033992 +0.34839758681058564 +0.13999176255344148 +0.954747472748305 +0.8213865904351656 +0.7353087213383943 +0.05293507671803588 +0.18928394491325828 +0.35663866312307635 +0.5635940875243229 +0.6826717634297086 +0.24961049579632655 +0.5113083759553145 +0.39035428378412507 +0.18478193164286472 +0.6597419571209191 +0.5956426019014396 +0.9718893673142627 +0.8806847571632049 +0.4926789279844227 +0.3051888002800478 +0.24799332262255724 +0.3759481831379463 +0.17633999428649172 +0.6936888599564529 +0.16530550321825166 +0.6025344178749164 +0.0551789181531438 +0.2641481639985547 +0.28451555274731855 +0.3310705746115199 +0.13028036961975176 +0.7487728053477253 +0.9357138254116824 +0.25277072158413594 +0.27945894431964147 +0.3269555568624475 +0.3209603541679118 +0.9243978729613413 +0.14401837577881305 +0.19111167203238177 +0.2306059817532189 +0.3772123036478402 +0.7016276161419842 +0.2425796892969334 +0.5746543920030653 +0.43396965475366367 +0.9688592835421302 +0.7666691365261079 +0.34592714992542617 +0.019562415498229346 +0.08119224908187062 +0.2083928921944651 +0.4814330290350195 +0.33480510357692717 +0.3402349440483783 +0.1394560685632068 +0.7769240828700293 +0.38147777003956196 +0.2328499782680632 +0.12218328891135355 +0.8684806364372117 +0.3745194711123515 +0.9193339066063804 +0.45017881639345736 +0.7841736777482041 +0.3251716676391142 +0.420990780080445 +0.30229134587325057 +0.5260700809875096 +0.13650474262718715 +0.887786029711926 +0.5645942173998904 +0.6204991605274727 +0.45172605268055166 +0.7041164148944846 +0.05004522005585588 +0.18945651439526445 +0.057562206593289145 +0.0005115898948883091 +0.94389370429751 +0.589841194966877 +0.8543970930407687 +0.1990752944362515 +0.7133657227802516 +0.4076584146275999 +0.42269758848542927 +0.1970377053142891 +0.18523529778341719 +0.23442218014112315 +0.020043958969856668 +0.8683888451420744 +0.8963084426055589 +0.6033003514240094 +0.7644020337974067 +0.1325551817366828 +0.6883403438928232 +0.0696770061004488 +0.7808712771900951 +0.8676233102752502 +0.7878527904342322 +0.5921161707261501 +0.028641208822538178 +0.9729290023262789 +0.3214807331424384 +0.8283270322046421 +0.25850658915835556 +0.9527280082076067 +0.27905690770843516 +0.8936357080649113 +0.5309486564073227 +0.7079588686356516 +0.9200323689617904 +0.7921248927383484 +0.0319615015197342 +0.27267019922571567 +0.9472194453616989 +0.9806628761543361 +0.987894719442812 +0.09323794320157663 +0.24854459139853313 +0.5499040635366669 +0.8053508806423493 +0.00232292526329958 +0.6965412340570454 +0.012522573211255272 +0.7536694680258196 +0.09945570214292376 +0.1810969765407452 +0.5492935325768823 +0.2845947517630274 +0.5642507658420168 +0.14777113424538157 +0.8517724428489523 +0.9227826253344183 +0.7591693803633006 +0.23577053541692894 +0.8472363932632425 +0.08456362587592392 +0.8165148666478764 +0.0696184594858521 +0.5545069339449122 +0.08490798936621391 +0.9951308555411419 +0.1746309226025935 +0.6740951689790556 +0.3787191301375179 +0.32809372189468633 +0.823314019530082 +0.3684171195579553 +0.6164208357485547 +0.5327032192886181 +0.548978731708661 +0.7780040435867366 +0.4886117035751838 +0.1707624385777612 +0.30421741310209616 +0.6722246625665227 +0.5481986466571327 +0.9472415912798465 +0.883825958788734 +0.21027946516823826 +0.08661186029689372 +0.49684074278708523 +0.14007021475996873 +0.7083779696400403 +0.8479151853620545 +0.6856816239358936 +0.8923499467878472 +0.592411774166396 +0.7672436591642403 +0.488531004783722 +0.33574907051610314 +0.08143763461836018 +0.9779152408831796 +0.7272743889343076 +0.7843657344096894 +0.8481414592588526 +0.9864949677692165 +0.5469487833963597 +0.6788032440961776 +0.8583250544661369 +0.09924199353703766 +0.2678308916990313 +0.6449379134071719 +0.025275384181633 +0.43261714492129477 +0.9192994882012687 +0.8339528914173123 +0.5240140916454521 +0.24093312996021032 +0.9438637438290468 +0.7396290574542499 +0.013131189771496299 +0.5647607406261114 +0.6756706915357087 +0.31728622429134334 +0.6144836080320213 +0.644657270270597 +0.2910285708650291 +0.5246617968752164 +0.6986064449725015 +0.1321565316914567 +0.8054049853864302 +0.2772005436454589 +0.09777918457958157 +0.2576629652930018 +0.8060203066883604 +0.41817124838371944 +0.26660742102248147 +0.7996487328351803 +0.8273186027967936 +0.3368945679348331 +0.6636192464869416 +0.605438062901539 +0.8307441405748424 +0.6260878742193361 +0.3453849416416941 +0.5479210336626454 +0.6480455612057998 +0.43113474229236926 +0.17111883891617008 +0.18319479185067378 +0.18542196774572273 +0.2962205215175151 +0.4108841091337443 +0.44157975330024146 +0.5013792676836784 +0.8534468250098285 +0.06046874751764886 +0.8618583621737542 +0.09012840069930739 +0.575975630651307 +0.08946068169856347 +0.49515146013980593 +0.6335789251211986 +0.019834606076390537 +0.2608277514506334 +0.22542186406218578 +0.6789536514293729 +0.7206310512224415 +0.35400499447830847 +0.7733601895541559 +0.996926713307083 +0.5131069267348308 +0.4826615688242082 +0.7348117894458732 +0.962588855152077 +0.17914221384935192 +0.5429065123578606 +0.7783039578056946 +0.41049772366070403 +0.5319830910127553 +0.6567198269280179 +0.18881863148140454 +0.330894828262982 +0.20935593018600673 +0.4030128855488849 +0.6338171215656808 +0.22568735670651485 +0.49621900466960034 +0.459613022411537 +0.5258813275558797 +0.4447593401836062 +0.46551003131965896 +0.3621940864960329 +0.3088065037219192 +0.8595173703964389 +0.36227388836250374 +0.029312166594182232 +0.6845180734234009 +0.3571744045676982 +0.6463658294916057 +0.7655555733777909 +0.026600800322377438 +0.9592942503216108 +0.4385866108117106 +0.6492303703324658 +0.4338807452614516 +0.5148932754644271 +0.6858735119905685 +0.21799034739580725 +0.9241085630742619 +0.040584629103344594 +0.7466535170169162 +0.4601675251741725 +0.21161390213812536 +0.7556392953469002 +0.8794469235324798 +0.9409815849271733 +0.12592657675645513 +0.039080375525831546 +0.40802046384789104 +0.5768411126134482 +0.392240738984716 +0.39334835045731653 +0.8732451913120117 +0.5595923685418662 +0.9897925075287934 +0.32831394148568993 +0.49704451940611116 +0.9197565938894192 +0.35727118821612025 +0.6245145361494547 +0.2947976257566278 +0.5926220803949815 +0.7394447554730054 +0.7054846018211152 +0.09741589429963271 +0.5729450003820947 +0.9427832031186616 +0.1829287768765131 +0.9632623316167594 +0.7171405266188611 +0.9886222739606412 +0.25265521107540845 +0.6227289071079649 +0.6309545842364322 +0.14369962915205003 +0.4164850892249059 +0.22619395434286138 +0.18726869568595883 +0.01042432554441275 +0.11090654603095018 +0.9116693323830063 +0.26538448943303317 +0.4705515031089387 +0.24880100700625052 +0.9870730058863542 +0.20926481997671564 +0.34588061282287763 +0.46749466284658747 +0.11585340097673946 +0.3226005260939362 +0.9932215666478221 +0.5114957824253362 +0.9955389844299418 +0.5400258633163912 +0.3993067425752538 +0.9152972502796715 +0.022001299527051432 +0.1989998234202458 +0.9382524733570571 +0.5779353591404234 +0.9704156578573686 +0.7281099600265879 +0.520084506525035 +0.6540579936356459 +0.5126368862072903 +0.20774913520811822 +0.7158044664237553 +0.923291852560841 +0.7694755512452165 +0.8558606084919893 +0.10607572849266311 +0.7603615121261182 +0.021851436949285152 +0.06645977370883438 +0.03380581421602946 +0.30711402698982226 +0.648384047657449 +0.7987828338134668 +0.718440819245824 +0.23973944618466525 +0.7416032811768923 +0.016699274446843604 +0.3323436291709728 +0.4316462182621047 +0.6138114621642724 +0.8822826619174486 +0.3353174521547625 +0.41544340965728077 +0.7742673934591305 +0.17450788432095676 +0.13005791916927623 +0.9736986374533545 +0.23125564123538722 +0.696819051721944 +0.728984442006048 +0.8079581248124904 +0.46978389873709436 +0.002832801027870646 +0.8964065524666706 +0.316074250328074 +0.9840933833302111 +0.3715054791577663 +0.41535375916262174 +0.1957939562719645 +0.05433229533679107 +0.2159228748360229 +0.2850456723616016 +0.4879331980619529 +0.9350604501355557 +0.9774393056487175 +0.032306613732547285 +0.9590333040920729 +0.1592274862276153 +0.45502956289803453 +0.965960510601904 +0.5320628033209552 +0.2357968349543721 +0.5972460362589005 +0.48631985573699354 +0.8905849460570637 +0.9247217912113445 +0.9190894697075259 +0.19408616563994063 +0.27944650413081207 +0.875786696583241 +0.7114577474526346 +0.9782034016607003 +0.4357897218592668 +0.50527381282535 +0.4382698248601741 +0.39661490132403143 +0.8392314949726573 +0.128176421627742 +0.6289775352177489 +0.12040940474008022 +0.2484297444783541 +0.7946851252699818 +0.40509498030250657 +0.032200229315239914 +0.7876880776040891 +0.672228854343781 +0.6535275478055009 +0.4071825501937183 +0.6894851647279617 +0.6970938573724043 +0.45047762839052286 +0.32413817379769083 +0.2331346183888463 +0.3241452370287249 +0.4979188278445492 +0.39144214341421657 +0.49865244898379146 +0.2848206929705278 +0.7560413304019347 +0.8624032533724059 +0.7847523931703649 +0.13504898801686505 +0.7054432057752753 +0.478713535052838 +0.8875124781105602 +0.24891690795521892 +0.8500338554344936 +0.7388836799664502 +0.048419986398996806 +0.519774790218875 +0.06075326185066521 +0.5924045765982915 +0.7759871319286726 +0.9756606090031102 +0.28733001220704824 +0.034532424630923875 +0.9982410662824659 +0.7737085866830513 +0.8044817598640611 +0.6343991390922598 +0.17296922368686063 +0.5350910042217434 +0.179079915573786 +0.8278965781691721 +0.529432682858147 +0.994099661208408 +0.04186778808389602 +0.3129601414469534 +0.7638248328228557 +0.4814878112759954 +0.7939784644723199 +0.33957731458823537 +0.9146789644915825 +0.5224440305539688 +0.9310950418636873 +0.38611350478995454 +0.264000081625951 +0.9065600467122011 +0.9174089185458028 +0.7830566269165662 +0.04725492448313551 +0.01920064204639671 +0.11660236258104306 +0.2771499502488458 +0.8352306010911253 +0.05428376454398953 +0.23161854690564299 +0.20266368851396077 +0.9733478258263121 +0.3055610895075097 +0.12577003490240346 +0.6665319927326261 +0.20308921328407614 +0.6256199449212814 +0.9811390490942644 +0.6642460977511329 +0.6930845123258408 +0.0058338698309746695 +0.9967574500231288 +0.8563457402073394 +0.31200998221852794 +0.8492017505533931 +0.02095774332753808 +0.42778662755090324 +0.027186744105201943 +0.7334507784613264 +0.6490537172020329 +0.6215088786254813 +0.43442149033222344 +0.040931337304090265 +0.8664809705741733 +0.5472835473989529 +0.546300391718062 +0.3849323564601397 +0.11675336844455741 +0.8572138757974119 +0.7897586052500741 +0.8331443636468118 +0.4637120086588029 +0.5833230826090611 +0.15755383003278922 +0.8796287757764542 +0.6750302859428917 +0.25440937614853754 +0.8290304146507526 +0.858294465506999 +0.6337115428024199 +0.15878158455411562 +0.2978051252432966 +0.0318929449162062 +0.5004451287010717 +0.6782034085018531 +0.48992208991252484 +0.8248902042010355 +0.7455984801536288 +0.9209703503322801 +0.5704745959980548 +0.8055378191933936 +0.7073567393131684 +0.07223156519904672 +0.4250744852720072 +0.8265116039250776 +0.5284673514016857 +0.3907059151447191 +0.09480233233937985 +0.07554140824071176 +0.20376915750401658 +0.5422863303914044 +0.9711721072758638 +0.2719816372744105 +0.2999234737500053 +0.9104736968808406 +0.17572130504435657 +0.19280221298204403 +0.6562965621039506 +0.17522961734232567 +0.09290337797890247 +0.8354610885185727 +0.9556915183352701 +0.8555688868096656 +0.8837239819759596 +0.0001379576679138017 +0.947012914241853 +0.03404468070592903 +0.11566672681993084 +0.8220665806683864 +0.662219420381477 +0.7308848334052779 +0.367385079077283 +0.17495769377321724 +0.7226545936070774 +0.21416446897906483 +0.9865952431680558 +0.027576949925289473 +0.19726119696052435 +0.3199772093337848 +0.670988283568863 +0.41122710945284346 +0.521337316732732 +0.8279870261687592 +0.30012625699977147 +0.9008735804035131 +0.3542572384151961 +0.48003069477725857 +0.5296854760022498 +0.5172505959916757 +0.7662473367714318 +0.3696636167042797 +0.8373483627640302 +0.0663331304028707 +0.20190996365029146 +0.6698165916451687 +0.9973928708439379 +0.9645139588277621 +0.5797032352937731 +0.7782965812348129 +0.8739483985899543 +0.3474662093325931 +0.3044727187392616 +0.72240183481003 +0.9366136567769461 +0.3345834912186014 +0.15763543189820117 +0.17347833493549258 +0.20817834581503902 +0.041256092715594384 +0.5866878122762447 +0.321331581373827 +0.3834993313375602 +0.10744511935402301 +0.48059423369674104 +0.67864332288794 +0.9074886767149931 +0.9971394346174389 +0.4718029091404867 +0.22319890328954872 +0.828669540791471 +0.28402147315241966 +0.5259346182354092 +0.8861893383793763 +0.06740407073087695 +0.9916472862574137 +0.5861193723845862 +0.28273734445205523 +0.5673817368785079 +0.9642260348234428 +0.9006935266826296 +0.3823226475867384 +0.7135327713884919 +0.6848870964569306 +0.1824824764783778 +0.17323932200081404 +0.6968526888715102 +0.41804453420545606 +0.6777519014955855 +0.14042840790717181 +0.5170035548595866 +0.7514308753092891 +0.5826095570746332 +0.612258057316104 +0.6177919026108166 +0.619017673865854 +0.63948489597244 +0.7412024227137837 +0.6282763162166608 +0.10312396814182645 +0.1138446092081341 +0.17041214594830645 +0.7766915065236526 +0.4541168411474126 +0.7917765396460701 +0.6203072101081253 +0.16775520855257275 +0.7779851529091911 +0.22148636936004895 +0.05493065916066309 +0.06907235896918695 +0.1543799633975298 +0.6621320385623942 +0.6492181303685314 +0.8545728965719739 +0.6615011185358145 +0.3229447272454157 +0.9517990260688887 +0.18296391467015383 +0.9112099867971957 +0.11307769729523809 +0.5446838176256797 +0.39310049662181046 +0.7591835581993036 +0.6510640411425068 +0.9669614373419594 +0.33504144672014424 +0.46899564925141624 +0.37643901501841004 +0.6006811011720938 +0.8589013207527408 +0.7589719305676297 +0.3247453490131832 +0.034638088053816074 +0.8896823211311813 +0.4622252152645787 +0.7634792290105328 +0.5559386225819801 +0.482494280839853 +0.4648556393406803 +0.23385178919992478 +0.6740840338402068 +0.494779691712927 +0.4084557649050422 +0.27678182127452 +0.13714402832059425 +0.18198509269310237 +0.7579117598368394 +0.030286174627052187 +0.7121951007915013 +0.23217582447396146 +0.7960126439340683 +0.5420716572256754 +0.6210869315961701 +0.6651043518815413 +0.37074461928654023 +0.8270398036333397 +0.5092516438785792 +0.44852712661666294 +0.786958847635865 +0.22156754285384428 +0.34218737959138956 +0.05912098513219732 +0.7796407931303314 +0.42422803263464226 +0.7435098904848829 +0.5641917320420474 +0.7754392437080894 +0.4218167972949217 +0.8788320755140397 +0.5349003957683597 +0.20935444679962656 +0.8421959939884889 +0.6923905131902395 +0.9008483831232639 +0.7670283071159404 +0.8773814819011445 +0.456172590073069 +0.917207419997926 From 6fcee26c78a3dab0c057f419ffc641e4b7f7bebc Mon Sep 17 00:00:00 2001 From: huayongpan Date: Thu, 25 Oct 2018 14:10:29 +0800 Subject: [PATCH 09/26] Add generated data --- 02-array-seq/floats.bin | Bin 0 -> 8000 bytes 02-array-seq/floats.txt | 1000 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 1000 insertions(+) create mode 100644 02-array-seq/floats.bin create mode 100644 02-array-seq/floats.txt diff --git a/02-array-seq/floats.bin b/02-array-seq/floats.bin new file mode 100644 index 0000000000000000000000000000000000000000..9877b93b0dc7090f4ce8573d3e6c63fc085c49b7 GIT binary patch literal 8000 zcmWlecRbba8^$H2qEMm`nUxS3DRQY4mD2DPQjrD?p^^|1StW$5qL7uwy<+d3PL=bf|r8on|h@o@dWc$rb;J~^k8Ay$feBt_o$nxo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D|J zsi6_X9Q-vAU_`@$PFa#+VK;uSPEwY*HxA=453z=$6l5&&No9WQM?tLasVbE*JgL<< zaN4Q~@4rgWF4H>^+GD&<{9rb+#*)xF%|utk)Bm0-kkNN)LBF$sfq(V|t>o3ipq>3S zdznPs4^C0}{`JA_5XI?|6btvZ9lyocL`B3ES=-Hozx*s>z4YLZaTI<#q#(GJj@YZq n{+1GRWy`hdY0qFLay6_>eb%v{;=}TtR2x8&fsl2j1sneZfez*m literal 0 HcmV?d00001 diff --git a/02-array-seq/floats.txt b/02-array-seq/floats.txt new file mode 100644 index 0000000..61a3502 --- /dev/null +++ b/02-array-seq/floats.txt @@ -0,0 +1,1000 @@ +0.5672087234214661 +0.3715446464824773 +0.9029868933699332 +0.597517269261967 +0.9642962297374326 +0.018515854462267223 +0.7416735924040715 +0.6292252523526574 +0.12150062512732762 +0.6315546169266913 +0.6217331018897596 +0.028225823047060894 +0.9806590049090178 +0.28045334371652675 +0.8509347164428829 +0.22262897562818007 +0.0700621966006646 +0.9411975115295255 +0.5975112189700034 +0.6450108439934424 +0.7951875312012301 +0.442328037149186 +0.35478997568097614 +0.5797172049033996 +0.5346914987244815 +0.15053880616416593 +0.3236969813016155 +0.39070859039950234 +0.4091586362224361 +0.5468176238477975 +0.4285970710296697 +0.5571450916137568 +0.15989751759911264 +0.41625779804943397 +0.6565304624640009 +0.381565322655669 +0.6491243102845079 +0.432937514367877 +0.009790189064869725 +0.4240126603062243 +0.723269845691147 +0.7644553538749663 +0.30501489335107324 +0.836555563332 +0.3497478702711855 +0.8383245567143863 +0.09886292943429087 +0.5577417642865227 +0.23540977525641427 +0.4194712799588116 +0.6734420536802627 +0.5377115976100824 +0.40764072795800044 +0.9376036205604947 +0.8912588368503107 +0.7338801090115283 +0.5022603037204608 +0.28537081584581103 +0.5644117540638129 +0.8835046673920117 +0.8825612161324567 +0.13903269426799048 +0.7234868763234438 +0.8307316412902469 +0.8591555536672247 +0.045507173574899196 +0.8869849923431151 +0.014727613177594634 +0.0037283646787705793 +0.9734822693996291 +0.9127874764096242 +0.26712641946681837 +0.8352632887756127 +0.6912154058193811 +0.3619911737971031 +0.31925383678998054 +0.0759863270639386 +0.9925837649349452 +0.8242097031491457 +0.17698998037965052 +0.6652944917258016 +0.019878364698023288 +0.12424000792997625 +0.5691756900150098 +0.7610753473290672 +0.8110444549348631 +0.9645839037006322 +0.7254564692201676 +0.055830273875597025 +0.4273496938170155 +0.8297264009516345 +0.8823263082831994 +0.3631659574916666 +0.3616833975683762 +0.7124957307958676 +0.6908410101391399 +0.2166148325863475 +0.48044981508655826 +0.9749464938539415 +0.9965135417425971 +0.22614163699370637 +0.24389221853061127 +0.5152815050730025 +0.28049907389498985 +0.54108652505173 +0.7575222664597618 +0.19463801747067222 +0.7262641355599533 +0.17725246280880935 +0.9816960945420308 +0.9407042079443705 +0.45344430860634655 +0.5692409083167216 +0.5800727076752696 +0.642950045854989 +0.36886071137220733 +0.15401704790959592 +0.28034269793725697 +0.7997994808072422 +0.27964036916395496 +0.025059642751159017 +0.08476994183790154 +0.5156725789849962 +0.7797987535362827 +0.7981284885671378 +0.5503686815413241 +0.6203157566339338 +0.3899388430115429 +0.898184684950611 +0.35151340925147156 +0.4566915344602208 +0.5433037203991101 +0.8419195313773077 +0.27499065230242814 +0.8975395988187622 +0.09540329711723039 +0.5522658835153107 +0.20616884308157324 +0.22174049512690552 +0.7230521765051388 +0.10689053176751162 +0.8099758063891256 +0.2373940404118431 +0.09511034543435481 +0.12886324729286303 +0.07286799385263754 +0.12307712170368701 +0.3581737379677121 +0.3414749950438509 +0.43251173136056353 +0.1498674437242421 +0.1483930260980223 +0.1427115677761387 +0.33083986350894934 +0.6966638361024153 +0.2863191206095884 +0.8881416751028007 +0.8569558448568998 +0.3335637039982273 +0.6822655862460206 +0.0016784483678957685 +0.36644193955537685 +0.32704462865368233 +0.9599255774926685 +0.412338201708184 +0.035307417271688735 +0.8910837211520892 +0.4061312749480994 +0.4541877632062229 +0.8595753876724792 +0.005885419022495508 +0.5604632079399972 +0.8394726590592712 +0.8116935652447627 +0.4500603904690512 +0.7437467809712313 +0.5083723543215037 +0.2433483060157876 +0.8044544803211341 +0.9130554888055452 +0.8261397650631385 +0.9962310418221352 +0.9055222562383264 +0.9094124592521733 +0.48487912596704563 +0.9847759517796298 +0.19786814934810082 +0.2991360031937741 +0.011785247029307278 +0.11435883307977768 +0.8567018784398248 +0.6887660845108939 +0.4289713738556623 +0.0851301462554438 +0.5085554306063218 +0.5269212732902704 +0.043115112826294655 +0.37576114566011065 +0.53642963594576 +0.300774986347748 +0.46228772698085774 +0.27925780822852175 +0.9713744670308018 +0.14794170844990973 +0.4173029056797921 +0.5851598040502632 +0.7128422264036158 +0.07537805709181267 +0.06866196884157261 +0.1602499103131232 +0.22901698089191447 +0.20674172705141258 +0.5308130992411165 +0.9753041710607273 +0.21789128815244718 +0.44839220202981944 +0.7688971653768878 +0.44225012481289094 +0.850249398784862 +0.35030781025981883 +0.18086995571257258 +0.06348871128820466 +0.9686583066541333 +0.0037419956524294973 +0.6586597466040051 +0.9832822015383741 +0.8965302143911061 +0.9425490241393908 +0.7815759053597333 +0.9786948672764244 +0.6124681584953854 +0.45087639730911966 +0.39625372787769186 +0.22102523036841437 +0.18722589500478382 +0.6840195547381434 +0.12143469933213968 +0.5757597893215731 +0.16670692546531185 +0.7047320702679396 +0.040607154677028356 +0.4305933662717908 +0.2201138910880861 +0.2673030537016239 +0.5805882189205686 +0.5049734729089645 +0.6803878340661202 +0.36223494128541733 +0.45374751695565874 +0.1466809738299285 +0.3914127298792246 +0.22230614933572057 +0.03510159432299709 +0.8943830151936528 +0.5943885039160551 +0.8379754774518582 +0.012842671049460352 +0.18536925925443726 +0.21797921639948759 +0.7527543978642408 +0.23443737456792357 +0.000940242943913594 +0.31523077382879316 +0.5235299059725492 +0.22201137614635058 +0.20491057357662945 +0.9728620458127791 +0.37064253419793025 +0.7160135083328346 +0.09352838347380565 +0.30882692739054585 +0.2532879825819895 +0.21834186542099265 +0.31328798946279635 +0.9211697319526553 +0.8965426146947912 +0.8653647952033992 +0.34839758681058564 +0.13999176255344148 +0.954747472748305 +0.8213865904351656 +0.7353087213383943 +0.05293507671803588 +0.18928394491325828 +0.35663866312307635 +0.5635940875243229 +0.6826717634297086 +0.24961049579632655 +0.5113083759553145 +0.39035428378412507 +0.18478193164286472 +0.6597419571209191 +0.5956426019014396 +0.9718893673142627 +0.8806847571632049 +0.4926789279844227 +0.3051888002800478 +0.24799332262255724 +0.3759481831379463 +0.17633999428649172 +0.6936888599564529 +0.16530550321825166 +0.6025344178749164 +0.0551789181531438 +0.2641481639985547 +0.28451555274731855 +0.3310705746115199 +0.13028036961975176 +0.7487728053477253 +0.9357138254116824 +0.25277072158413594 +0.27945894431964147 +0.3269555568624475 +0.3209603541679118 +0.9243978729613413 +0.14401837577881305 +0.19111167203238177 +0.2306059817532189 +0.3772123036478402 +0.7016276161419842 +0.2425796892969334 +0.5746543920030653 +0.43396965475366367 +0.9688592835421302 +0.7666691365261079 +0.34592714992542617 +0.019562415498229346 +0.08119224908187062 +0.2083928921944651 +0.4814330290350195 +0.33480510357692717 +0.3402349440483783 +0.1394560685632068 +0.7769240828700293 +0.38147777003956196 +0.2328499782680632 +0.12218328891135355 +0.8684806364372117 +0.3745194711123515 +0.9193339066063804 +0.45017881639345736 +0.7841736777482041 +0.3251716676391142 +0.420990780080445 +0.30229134587325057 +0.5260700809875096 +0.13650474262718715 +0.887786029711926 +0.5645942173998904 +0.6204991605274727 +0.45172605268055166 +0.7041164148944846 +0.05004522005585588 +0.18945651439526445 +0.057562206593289145 +0.0005115898948883091 +0.94389370429751 +0.589841194966877 +0.8543970930407687 +0.1990752944362515 +0.7133657227802516 +0.4076584146275999 +0.42269758848542927 +0.1970377053142891 +0.18523529778341719 +0.23442218014112315 +0.020043958969856668 +0.8683888451420744 +0.8963084426055589 +0.6033003514240094 +0.7644020337974067 +0.1325551817366828 +0.6883403438928232 +0.0696770061004488 +0.7808712771900951 +0.8676233102752502 +0.7878527904342322 +0.5921161707261501 +0.028641208822538178 +0.9729290023262789 +0.3214807331424384 +0.8283270322046421 +0.25850658915835556 +0.9527280082076067 +0.27905690770843516 +0.8936357080649113 +0.5309486564073227 +0.7079588686356516 +0.9200323689617904 +0.7921248927383484 +0.0319615015197342 +0.27267019922571567 +0.9472194453616989 +0.9806628761543361 +0.987894719442812 +0.09323794320157663 +0.24854459139853313 +0.5499040635366669 +0.8053508806423493 +0.00232292526329958 +0.6965412340570454 +0.012522573211255272 +0.7536694680258196 +0.09945570214292376 +0.1810969765407452 +0.5492935325768823 +0.2845947517630274 +0.5642507658420168 +0.14777113424538157 +0.8517724428489523 +0.9227826253344183 +0.7591693803633006 +0.23577053541692894 +0.8472363932632425 +0.08456362587592392 +0.8165148666478764 +0.0696184594858521 +0.5545069339449122 +0.08490798936621391 +0.9951308555411419 +0.1746309226025935 +0.6740951689790556 +0.3787191301375179 +0.32809372189468633 +0.823314019530082 +0.3684171195579553 +0.6164208357485547 +0.5327032192886181 +0.548978731708661 +0.7780040435867366 +0.4886117035751838 +0.1707624385777612 +0.30421741310209616 +0.6722246625665227 +0.5481986466571327 +0.9472415912798465 +0.883825958788734 +0.21027946516823826 +0.08661186029689372 +0.49684074278708523 +0.14007021475996873 +0.7083779696400403 +0.8479151853620545 +0.6856816239358936 +0.8923499467878472 +0.592411774166396 +0.7672436591642403 +0.488531004783722 +0.33574907051610314 +0.08143763461836018 +0.9779152408831796 +0.7272743889343076 +0.7843657344096894 +0.8481414592588526 +0.9864949677692165 +0.5469487833963597 +0.6788032440961776 +0.8583250544661369 +0.09924199353703766 +0.2678308916990313 +0.6449379134071719 +0.025275384181633 +0.43261714492129477 +0.9192994882012687 +0.8339528914173123 +0.5240140916454521 +0.24093312996021032 +0.9438637438290468 +0.7396290574542499 +0.013131189771496299 +0.5647607406261114 +0.6756706915357087 +0.31728622429134334 +0.6144836080320213 +0.644657270270597 +0.2910285708650291 +0.5246617968752164 +0.6986064449725015 +0.1321565316914567 +0.8054049853864302 +0.2772005436454589 +0.09777918457958157 +0.2576629652930018 +0.8060203066883604 +0.41817124838371944 +0.26660742102248147 +0.7996487328351803 +0.8273186027967936 +0.3368945679348331 +0.6636192464869416 +0.605438062901539 +0.8307441405748424 +0.6260878742193361 +0.3453849416416941 +0.5479210336626454 +0.6480455612057998 +0.43113474229236926 +0.17111883891617008 +0.18319479185067378 +0.18542196774572273 +0.2962205215175151 +0.4108841091337443 +0.44157975330024146 +0.5013792676836784 +0.8534468250098285 +0.06046874751764886 +0.8618583621737542 +0.09012840069930739 +0.575975630651307 +0.08946068169856347 +0.49515146013980593 +0.6335789251211986 +0.019834606076390537 +0.2608277514506334 +0.22542186406218578 +0.6789536514293729 +0.7206310512224415 +0.35400499447830847 +0.7733601895541559 +0.996926713307083 +0.5131069267348308 +0.4826615688242082 +0.7348117894458732 +0.962588855152077 +0.17914221384935192 +0.5429065123578606 +0.7783039578056946 +0.41049772366070403 +0.5319830910127553 +0.6567198269280179 +0.18881863148140454 +0.330894828262982 +0.20935593018600673 +0.4030128855488849 +0.6338171215656808 +0.22568735670651485 +0.49621900466960034 +0.459613022411537 +0.5258813275558797 +0.4447593401836062 +0.46551003131965896 +0.3621940864960329 +0.3088065037219192 +0.8595173703964389 +0.36227388836250374 +0.029312166594182232 +0.6845180734234009 +0.3571744045676982 +0.6463658294916057 +0.7655555733777909 +0.026600800322377438 +0.9592942503216108 +0.4385866108117106 +0.6492303703324658 +0.4338807452614516 +0.5148932754644271 +0.6858735119905685 +0.21799034739580725 +0.9241085630742619 +0.040584629103344594 +0.7466535170169162 +0.4601675251741725 +0.21161390213812536 +0.7556392953469002 +0.8794469235324798 +0.9409815849271733 +0.12592657675645513 +0.039080375525831546 +0.40802046384789104 +0.5768411126134482 +0.392240738984716 +0.39334835045731653 +0.8732451913120117 +0.5595923685418662 +0.9897925075287934 +0.32831394148568993 +0.49704451940611116 +0.9197565938894192 +0.35727118821612025 +0.6245145361494547 +0.2947976257566278 +0.5926220803949815 +0.7394447554730054 +0.7054846018211152 +0.09741589429963271 +0.5729450003820947 +0.9427832031186616 +0.1829287768765131 +0.9632623316167594 +0.7171405266188611 +0.9886222739606412 +0.25265521107540845 +0.6227289071079649 +0.6309545842364322 +0.14369962915205003 +0.4164850892249059 +0.22619395434286138 +0.18726869568595883 +0.01042432554441275 +0.11090654603095018 +0.9116693323830063 +0.26538448943303317 +0.4705515031089387 +0.24880100700625052 +0.9870730058863542 +0.20926481997671564 +0.34588061282287763 +0.46749466284658747 +0.11585340097673946 +0.3226005260939362 +0.9932215666478221 +0.5114957824253362 +0.9955389844299418 +0.5400258633163912 +0.3993067425752538 +0.9152972502796715 +0.022001299527051432 +0.1989998234202458 +0.9382524733570571 +0.5779353591404234 +0.9704156578573686 +0.7281099600265879 +0.520084506525035 +0.6540579936356459 +0.5126368862072903 +0.20774913520811822 +0.7158044664237553 +0.923291852560841 +0.7694755512452165 +0.8558606084919893 +0.10607572849266311 +0.7603615121261182 +0.021851436949285152 +0.06645977370883438 +0.03380581421602946 +0.30711402698982226 +0.648384047657449 +0.7987828338134668 +0.718440819245824 +0.23973944618466525 +0.7416032811768923 +0.016699274446843604 +0.3323436291709728 +0.4316462182621047 +0.6138114621642724 +0.8822826619174486 +0.3353174521547625 +0.41544340965728077 +0.7742673934591305 +0.17450788432095676 +0.13005791916927623 +0.9736986374533545 +0.23125564123538722 +0.696819051721944 +0.728984442006048 +0.8079581248124904 +0.46978389873709436 +0.002832801027870646 +0.8964065524666706 +0.316074250328074 +0.9840933833302111 +0.3715054791577663 +0.41535375916262174 +0.1957939562719645 +0.05433229533679107 +0.2159228748360229 +0.2850456723616016 +0.4879331980619529 +0.9350604501355557 +0.9774393056487175 +0.032306613732547285 +0.9590333040920729 +0.1592274862276153 +0.45502956289803453 +0.965960510601904 +0.5320628033209552 +0.2357968349543721 +0.5972460362589005 +0.48631985573699354 +0.8905849460570637 +0.9247217912113445 +0.9190894697075259 +0.19408616563994063 +0.27944650413081207 +0.875786696583241 +0.7114577474526346 +0.9782034016607003 +0.4357897218592668 +0.50527381282535 +0.4382698248601741 +0.39661490132403143 +0.8392314949726573 +0.128176421627742 +0.6289775352177489 +0.12040940474008022 +0.2484297444783541 +0.7946851252699818 +0.40509498030250657 +0.032200229315239914 +0.7876880776040891 +0.672228854343781 +0.6535275478055009 +0.4071825501937183 +0.6894851647279617 +0.6970938573724043 +0.45047762839052286 +0.32413817379769083 +0.2331346183888463 +0.3241452370287249 +0.4979188278445492 +0.39144214341421657 +0.49865244898379146 +0.2848206929705278 +0.7560413304019347 +0.8624032533724059 +0.7847523931703649 +0.13504898801686505 +0.7054432057752753 +0.478713535052838 +0.8875124781105602 +0.24891690795521892 +0.8500338554344936 +0.7388836799664502 +0.048419986398996806 +0.519774790218875 +0.06075326185066521 +0.5924045765982915 +0.7759871319286726 +0.9756606090031102 +0.28733001220704824 +0.034532424630923875 +0.9982410662824659 +0.7737085866830513 +0.8044817598640611 +0.6343991390922598 +0.17296922368686063 +0.5350910042217434 +0.179079915573786 +0.8278965781691721 +0.529432682858147 +0.994099661208408 +0.04186778808389602 +0.3129601414469534 +0.7638248328228557 +0.4814878112759954 +0.7939784644723199 +0.33957731458823537 +0.9146789644915825 +0.5224440305539688 +0.9310950418636873 +0.38611350478995454 +0.264000081625951 +0.9065600467122011 +0.9174089185458028 +0.7830566269165662 +0.04725492448313551 +0.01920064204639671 +0.11660236258104306 +0.2771499502488458 +0.8352306010911253 +0.05428376454398953 +0.23161854690564299 +0.20266368851396077 +0.9733478258263121 +0.3055610895075097 +0.12577003490240346 +0.6665319927326261 +0.20308921328407614 +0.6256199449212814 +0.9811390490942644 +0.6642460977511329 +0.6930845123258408 +0.0058338698309746695 +0.9967574500231288 +0.8563457402073394 +0.31200998221852794 +0.8492017505533931 +0.02095774332753808 +0.42778662755090324 +0.027186744105201943 +0.7334507784613264 +0.6490537172020329 +0.6215088786254813 +0.43442149033222344 +0.040931337304090265 +0.8664809705741733 +0.5472835473989529 +0.546300391718062 +0.3849323564601397 +0.11675336844455741 +0.8572138757974119 +0.7897586052500741 +0.8331443636468118 +0.4637120086588029 +0.5833230826090611 +0.15755383003278922 +0.8796287757764542 +0.6750302859428917 +0.25440937614853754 +0.8290304146507526 +0.858294465506999 +0.6337115428024199 +0.15878158455411562 +0.2978051252432966 +0.0318929449162062 +0.5004451287010717 +0.6782034085018531 +0.48992208991252484 +0.8248902042010355 +0.7455984801536288 +0.9209703503322801 +0.5704745959980548 +0.8055378191933936 +0.7073567393131684 +0.07223156519904672 +0.4250744852720072 +0.8265116039250776 +0.5284673514016857 +0.3907059151447191 +0.09480233233937985 +0.07554140824071176 +0.20376915750401658 +0.5422863303914044 +0.9711721072758638 +0.2719816372744105 +0.2999234737500053 +0.9104736968808406 +0.17572130504435657 +0.19280221298204403 +0.6562965621039506 +0.17522961734232567 +0.09290337797890247 +0.8354610885185727 +0.9556915183352701 +0.8555688868096656 +0.8837239819759596 +0.0001379576679138017 +0.947012914241853 +0.03404468070592903 +0.11566672681993084 +0.8220665806683864 +0.662219420381477 +0.7308848334052779 +0.367385079077283 +0.17495769377321724 +0.7226545936070774 +0.21416446897906483 +0.9865952431680558 +0.027576949925289473 +0.19726119696052435 +0.3199772093337848 +0.670988283568863 +0.41122710945284346 +0.521337316732732 +0.8279870261687592 +0.30012625699977147 +0.9008735804035131 +0.3542572384151961 +0.48003069477725857 +0.5296854760022498 +0.5172505959916757 +0.7662473367714318 +0.3696636167042797 +0.8373483627640302 +0.0663331304028707 +0.20190996365029146 +0.6698165916451687 +0.9973928708439379 +0.9645139588277621 +0.5797032352937731 +0.7782965812348129 +0.8739483985899543 +0.3474662093325931 +0.3044727187392616 +0.72240183481003 +0.9366136567769461 +0.3345834912186014 +0.15763543189820117 +0.17347833493549258 +0.20817834581503902 +0.041256092715594384 +0.5866878122762447 +0.321331581373827 +0.3834993313375602 +0.10744511935402301 +0.48059423369674104 +0.67864332288794 +0.9074886767149931 +0.9971394346174389 +0.4718029091404867 +0.22319890328954872 +0.828669540791471 +0.28402147315241966 +0.5259346182354092 +0.8861893383793763 +0.06740407073087695 +0.9916472862574137 +0.5861193723845862 +0.28273734445205523 +0.5673817368785079 +0.9642260348234428 +0.9006935266826296 +0.3823226475867384 +0.7135327713884919 +0.6848870964569306 +0.1824824764783778 +0.17323932200081404 +0.6968526888715102 +0.41804453420545606 +0.6777519014955855 +0.14042840790717181 +0.5170035548595866 +0.7514308753092891 +0.5826095570746332 +0.612258057316104 +0.6177919026108166 +0.619017673865854 +0.63948489597244 +0.7412024227137837 +0.6282763162166608 +0.10312396814182645 +0.1138446092081341 +0.17041214594830645 +0.7766915065236526 +0.4541168411474126 +0.7917765396460701 +0.6203072101081253 +0.16775520855257275 +0.7779851529091911 +0.22148636936004895 +0.05493065916066309 +0.06907235896918695 +0.1543799633975298 +0.6621320385623942 +0.6492181303685314 +0.8545728965719739 +0.6615011185358145 +0.3229447272454157 +0.9517990260688887 +0.18296391467015383 +0.9112099867971957 +0.11307769729523809 +0.5446838176256797 +0.39310049662181046 +0.7591835581993036 +0.6510640411425068 +0.9669614373419594 +0.33504144672014424 +0.46899564925141624 +0.37643901501841004 +0.6006811011720938 +0.8589013207527408 +0.7589719305676297 +0.3247453490131832 +0.034638088053816074 +0.8896823211311813 +0.4622252152645787 +0.7634792290105328 +0.5559386225819801 +0.482494280839853 +0.4648556393406803 +0.23385178919992478 +0.6740840338402068 +0.494779691712927 +0.4084557649050422 +0.27678182127452 +0.13714402832059425 +0.18198509269310237 +0.7579117598368394 +0.030286174627052187 +0.7121951007915013 +0.23217582447396146 +0.7960126439340683 +0.5420716572256754 +0.6210869315961701 +0.6651043518815413 +0.37074461928654023 +0.8270398036333397 +0.5092516438785792 +0.44852712661666294 +0.786958847635865 +0.22156754285384428 +0.34218737959138956 +0.05912098513219732 +0.7796407931303314 +0.42422803263464226 +0.7435098904848829 +0.5641917320420474 +0.7754392437080894 +0.4218167972949217 +0.8788320755140397 +0.5349003957683597 +0.20935444679962656 +0.8421959939884889 +0.6923905131902395 +0.9008483831232639 +0.7670283071159404 +0.8773814819011445 +0.456172590073069 +0.917207419997926 From 9edd94ed6183454c397c8c8d278bc9eb1fba83c3 Mon Sep 17 00:00:00 2001 From: huayongpan Date: Fri, 26 Oct 2018 11:55:21 +0800 Subject: [PATCH 10/26] Add example 4 10 --- 04-text-byte/example_4_10.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/04-text-byte/example_4_10.py b/04-text-byte/example_4_10.py index 26fbfa8..d36fcf0 100644 --- a/04-text-byte/example_4_10.py +++ b/04-text-byte/example_4_10.py @@ -1,11 +1,15 @@ fp = open('cafe.txt', 'w', encoding='utf-8') print(fp) +# <_io.TextIOWrapper name='cafe.txt' mode='w' encoding='utf-8'> +# 默认情况下,open函数采用文本模式,返回一个TextIOWrapper对象 print(fp.write('café')) +# 在TextIOWrapper对象上调用write方法返回写入的Unicode字符数:4 fp.close() import os print(os.stat('cafe.txt').st_size) fp2 = open('cafe.txt') print(fp2) +# 返回一个TextIOWrapper对象,编码是区域设置中的默认值 print(fp2.encoding) print(fp2.read()) fp.close() @@ -15,5 +19,7 @@ fp3.close() fp4 = open('cafe.txt', 'rb') print(fp4) +# 'rb'标识指明在二进制模式中读取文件 +# 返回的是BufferedReader对象,而不是TextIOWrapper对象 print(fp4.read()) fp4.close() From b2b861a54d3a9cd243298bd25211888417871d25 Mon Sep 17 00:00:00 2001 From: huayongpan Date: Mon, 15 Oct 2018 12:31:01 +0800 Subject: [PATCH 11/26] Add chapter_02 examples --- 02-array-seq/example_2_11.py | 14 ++++++++++++++ 02-array-seq/example_2_17.py | 26 ++++++++++++++++++++++++++ 02-array-seq/example_2_18.py | 9 +++++++++ 02-array-seq/example_2_19.py | 13 +++++++++++++ 02-array-seq/example_2_20.py | 22 ++++++++++++++++++++++ 02-array-seq/example_2_21.py | 13 +++++++++++++ 02-array-seq/example_2_23.py | 14 ++++++++++++++ 7 files changed, 111 insertions(+) create mode 100644 02-array-seq/example_2_11.py create mode 100644 02-array-seq/example_2_17.py create mode 100644 02-array-seq/example_2_18.py create mode 100644 02-array-seq/example_2_19.py create mode 100644 02-array-seq/example_2_20.py create mode 100644 02-array-seq/example_2_21.py create mode 100644 02-array-seq/example_2_23.py diff --git a/02-array-seq/example_2_11.py b/02-array-seq/example_2_11.py new file mode 100644 index 0000000..8687930 --- /dev/null +++ b/02-array-seq/example_2_11.py @@ -0,0 +1,14 @@ +invoice = """ +0 6 40 52 55 +1909 Pimoroni PiBrella $17.50 3 $52.50 +1489 6mm Tactile Switch x20 $4.95 2 $9.90 +""" + +SKU = slice(0, 6) +DESCRIPTION = slice(6, 40) +UNIT_PRICE = slice(40, 52) +QUANTITY = slice(52, 55) +ITEM_TOTAL = slice(55, None) +line_items = invoice.split('\n')[2:] +for item in line_items: + print(item[UNIT_PRICE], item[DESCRIPTION]) \ No newline at end of file diff --git a/02-array-seq/example_2_17.py b/02-array-seq/example_2_17.py new file mode 100644 index 0000000..144599c --- /dev/null +++ b/02-array-seq/example_2_17.py @@ -0,0 +1,26 @@ +import bisect +import sys + +HAYSTACK = [1, 4, 5, 6, 8, 12, 15, 20, 21, 23, 23, 26, 29, 30] +NEEDLES = [0, 1, 2, 5, 8, 10, 22, 23, 29, 30, 31] + +ROW_FMT = '{0:2d} @ {1:2d} {2}{0:<2d}' + +def demo(bisect_fn): + for needle in reversed(NEEDLES): + position = bisect_fn(HAYSTACK, needle) + offset = position * ' |' + print(ROW_FMT.format(needle, position, offset)) + +if __name__ == '__main__': + # bisect 函数其实是bisect_right函数的别名 + # bisect_left返回的插入位置是原序列中跟被插入元素相等元素的位置的前面 + # bisect_right返回的插入位置是原序列中跟被插入元素相等元素的位置的后面 + if sys.argv[-1] == 'left': + bisect_fn = bisect.bisect_left + else: + bisect_fn = bisect.bisect + + print('DEMO:', bisect_fn.__name__) + print('haystack ->', ' '.join('%2d' % n for n in HAYSTACK)) + demo(bisect_fn) \ No newline at end of file diff --git a/02-array-seq/example_2_18.py b/02-array-seq/example_2_18.py new file mode 100644 index 0000000..855ac18 --- /dev/null +++ b/02-array-seq/example_2_18.py @@ -0,0 +1,9 @@ +import bisect + +def grade(score, breakpoints=[60, 70, 80, 90], grades='FDCBA'): + i = bisect.bisect(breakpoints, score) + return grades[i] + + +if __name__ == '__main__': + print([grade(score) for score in [33, 99, 77, 70, 89, 90, 100]]) \ No newline at end of file diff --git a/02-array-seq/example_2_19.py b/02-array-seq/example_2_19.py new file mode 100644 index 0000000..1e271ab --- /dev/null +++ b/02-array-seq/example_2_19.py @@ -0,0 +1,13 @@ +import bisect +import random + +SIZE = 7 + +random.seed(1729) + +my_list = [] + +for i in range(SIZE): + new_item = random.randrange(SIZE*2) + bisect.insort(my_list, new_item) + print('%2d ->' % new_item, my_list) \ No newline at end of file diff --git a/02-array-seq/example_2_20.py b/02-array-seq/example_2_20.py new file mode 100644 index 0000000..da0361d --- /dev/null +++ b/02-array-seq/example_2_20.py @@ -0,0 +1,22 @@ +from array import array +from random import random + +floats1 = array('d', (random() for i in range(10**7))) +print(floats1[-1]) + +fp = open('floats.bin', 'wb') +floats1.tofile(fp) +fp.close() + +fp = open('floats.txt', 'w') +for item in floats1: + fp.write(str(item) + '\n') +fp.close() + +floats2 = array('d') +fp = open('floats.bin', 'rb') +floats2.fromfile(fp, 10**7) +fp.close() +print(floats2[-1]) + +print('floats1 == floats2', floats1 == floats2) diff --git a/02-array-seq/example_2_21.py b/02-array-seq/example_2_21.py new file mode 100644 index 0000000..45612dd --- /dev/null +++ b/02-array-seq/example_2_21.py @@ -0,0 +1,13 @@ +from array import array + +numbers = array('h', [-2, -1, 0, 1, 2]) +memv = memoryview(numbers) +print('length of memoryview:', len(memv)) +print('the first element:', memv[0]) +#转换成单字节,查看numbers +memv_oct = memv.cast('B') +print(memv_oct.tolist()) +memv_oct[5] = 4 +#占2个字节的整数的高位字节改成了4 +print(numbers) + diff --git a/02-array-seq/example_2_23.py b/02-array-seq/example_2_23.py new file mode 100644 index 0000000..9e8f0a3 --- /dev/null +++ b/02-array-seq/example_2_23.py @@ -0,0 +1,14 @@ +from collections import deque + +dq = deque(range(10), maxlen=10) +print(dq) +dq.rotate(3) +print(dq) +dq.rotate(-4) +print(dq) +dq.appendleft(-1) +print(dq) +dq.extend([11, 22, 33]) +print(dq) +dq.extendleft([40, 30, 20, 10]) +print(dq) \ No newline at end of file From 0f5e641d99bb4430e62186cdcbff2ddf32181e43 Mon Sep 17 00:00:00 2001 From: huayongpan Date: Mon, 15 Oct 2018 12:31:29 +0800 Subject: [PATCH 12/26] Add chapter_03 examples --- 03-dict-set/example_3_5.py | 18 ++++++++++++++++++ 03-dict-set/example_3_7.py | 24 ++++++++++++++++++++++++ 03-dict-set/example_3_9.py | 22 ++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 03-dict-set/example_3_5.py create mode 100644 03-dict-set/example_3_7.py create mode 100644 03-dict-set/example_3_9.py diff --git a/03-dict-set/example_3_5.py b/03-dict-set/example_3_5.py new file mode 100644 index 0000000..ba9b19b --- /dev/null +++ b/03-dict-set/example_3_5.py @@ -0,0 +1,18 @@ +import sys +import re +import collections + +WORD_RE = re.compile(r'\w+') +index = collections.defaultdict(list) + +with open('./paragraph.txt', encoding='utf-8') as fp: + for line_no, line in enumerate(fp, 1): + for match in WORD_RE.finditer(line): + word = match.group() + column_no = match.start() + 1 + location = (line_no, column_no) + index[word].append(location) + + +for word in sorted(index, key=str.upper): + print(word, index[word]) \ No newline at end of file diff --git a/03-dict-set/example_3_7.py b/03-dict-set/example_3_7.py new file mode 100644 index 0000000..779c6dd --- /dev/null +++ b/03-dict-set/example_3_7.py @@ -0,0 +1,24 @@ +# +class StrKeyDict0(dict): + def __missing__(self, key): + if isinstance(key, str): + raise KeyError(key) + return self[str(key)] + + def get(self, key, default=None): + try: + return self[key] + except: + return default + + def __contains__(self, key): + return key in self.keys() or str(key) in self.keys() + +if __name__ == '__main__': + d = StrKeyDict0([('2', 'two'), ('4', 'four')]) + print(d['2']) + print(d[4]) + # print(d[1]) + print(d.get('2')) + print(d.get(4)) + print(d.get(1, 'N/A')) \ No newline at end of file diff --git a/03-dict-set/example_3_9.py b/03-dict-set/example_3_9.py new file mode 100644 index 0000000..e1adcee --- /dev/null +++ b/03-dict-set/example_3_9.py @@ -0,0 +1,22 @@ +from types import MappingProxyType + +d = { 1:'A'} +d_proxy = MappingProxyType(d) +print(d_proxy) +print(d_proxy[1]) +d_proxy[2] = 'x' + +d_proxy +Out[3]: mappingproxy({1: 'A'}) +d_proxy[2] = 'x' +# Traceback +# File "", line 1, in +# d_proxy[2] = 'x' +# TypeError: 'mappingproxy' object does not support item assignment +d_proxy +Out[5]: mappingproxy({1: 'A'}) +d[2] = 'B' +d_proxy +Out[7]: mappingproxy({1: 'A', 2: 'B'}) +d_proxy[2] +Out[8]: 'B' \ No newline at end of file From e8cc6ccffb04f9ccb13633aec54c328fed61d95a Mon Sep 17 00:00:00 2001 From: huayongpan Date: Mon, 15 Oct 2018 12:32:24 +0800 Subject: [PATCH 13/26] Add support materials --- 03-dict-set/paragraph.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 03-dict-set/paragraph.txt diff --git a/03-dict-set/paragraph.txt b/03-dict-set/paragraph.txt new file mode 100644 index 0000000..018b329 --- /dev/null +++ b/03-dict-set/paragraph.txt @@ -0,0 +1,21 @@ +Brazilians will vote Sunday in presidential elections. +A total of 13 candidates are on the ballot. +The leading candidate is said to be 63-year-old Jair Bolsonaro of the Social Liberal Party. +He is supported by 35 percent of likely voters in the latest opinion survey. +During the election campaign, Bolsonaro has said that, if elected, he will help Brazil deal with a number of problems. +He has promised to take steps to reduce crime, strengthen the economy and fight corruption. +But many Brazilians are concerned about some of the statements Bolsonaro has made in the past. +Some believe many of his ideas are racist, homophobic and unfair to women. +Bolsonaro's supporters say tens of millions of Brazilians hope he will be elected, even if they will not say so to friends or family members. +In opinion surveys, his nearest opponent is Workers' Party candidate Fernando Haddad, who replaced former president Luiz Inacio Lula da Silva. +Lula is serving a 12-year prison sentence for corruption. Brazil's top electoral court barred him from serving as a candidate in August. +Last month, Lula told supporters, "I want everyone who would vote for me to vote for Fernando Haddad for president of Brazil. +From now on, he will be Lula for millions of Brazilians." +Haddad and Lula are said to be friends and similar in their political positions. +But for many voters in Brazil, the two men are also very different. +Lula served as the country's president between 2003 and 2011. +Haddad was mayor of Sao Paolo for four years, from 2013 to 2017. +Before becoming a candidate for mayor in 2012, Haddad served as Brazil's education minister under Lula and then former president Dilma Rousseff. +American Mark Jones has been watching the election campaign. +Jones is head of the Latin American Studies program at Rice University in Houston, Texas. +He says a Bolsonaro victory would represent a move away from traditional party candidates in Brazil. \ No newline at end of file From cd95fd53596a96131f6e4aaeb83997c062bf5500 Mon Sep 17 00:00:00 2001 From: huayongpan Date: Thu, 25 Oct 2018 09:44:05 +0800 Subject: [PATCH 14/26] Add example_4_10 --- 04-text-byte/example_4_10.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 04-text-byte/example_4_10.py diff --git a/04-text-byte/example_4_10.py b/04-text-byte/example_4_10.py new file mode 100644 index 0000000..26fbfa8 --- /dev/null +++ b/04-text-byte/example_4_10.py @@ -0,0 +1,19 @@ +fp = open('cafe.txt', 'w', encoding='utf-8') +print(fp) +print(fp.write('café')) +fp.close() +import os +print(os.stat('cafe.txt').st_size) +fp2 = open('cafe.txt') +print(fp2) +print(fp2.encoding) +print(fp2.read()) +fp.close() +fp3 = open('cafe.txt', encoding='utf-8') +print(fp3) +print(fp3.read()) +fp3.close() +fp4 = open('cafe.txt', 'rb') +print(fp4) +print(fp4.read()) +fp4.close() From c28dacd940105db6ae147076bccd9ce4902bb6b4 Mon Sep 17 00:00:00 2001 From: huayongpan Date: Thu, 25 Oct 2018 10:05:08 +0800 Subject: [PATCH 15/26] Change the number of items --- 02-array-seq/example_2_20.py | 4 ++-- 04-text-byte/cafe.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 04-text-byte/cafe.txt diff --git a/02-array-seq/example_2_20.py b/02-array-seq/example_2_20.py index da0361d..a7cec30 100644 --- a/02-array-seq/example_2_20.py +++ b/02-array-seq/example_2_20.py @@ -1,7 +1,7 @@ from array import array from random import random -floats1 = array('d', (random() for i in range(10**7))) +floats1 = array('d', (random() for i in range(10**3))) print(floats1[-1]) fp = open('floats.bin', 'wb') @@ -15,7 +15,7 @@ floats2 = array('d') fp = open('floats.bin', 'rb') -floats2.fromfile(fp, 10**7) +floats2.fromfile(fp, 10**3) fp.close() print(floats2[-1]) diff --git a/04-text-byte/cafe.txt b/04-text-byte/cafe.txt new file mode 100644 index 0000000..1c2e52c --- /dev/null +++ b/04-text-byte/cafe.txt @@ -0,0 +1 @@ +café \ No newline at end of file From 87049ab29f878a445dc9a86c4453289a32c7e3f6 Mon Sep 17 00:00:00 2001 From: huayongpan Date: Thu, 25 Oct 2018 14:10:29 +0800 Subject: [PATCH 16/26] Add generated data --- 02-array-seq/floats.bin | Bin 0 -> 8000 bytes 02-array-seq/floats.txt | 1000 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 1000 insertions(+) create mode 100644 02-array-seq/floats.bin create mode 100644 02-array-seq/floats.txt diff --git a/02-array-seq/floats.bin b/02-array-seq/floats.bin new file mode 100644 index 0000000000000000000000000000000000000000..9877b93b0dc7090f4ce8573d3e6c63fc085c49b7 GIT binary patch literal 8000 zcmWlecRbba8^$H2qEMm`nUxS3DRQY4mD2DPQjrD?p^^|1StW$5qL7uwy<+d3PL=bf|r8on|h@o@dWc$rb;J~^k8Ay$feBt_o$nxo))?a-=A z8-c#!vxz;7c*IAYUJS9}phT}DVtTq2ats3}@}3Dq`+e0A_iBRc?E1K9P9DOAZ1s*v zPC|)CptprMxA%!)9Xn|h^@bu+%Fbgj-F0oBm`OkM=m|@yAG<(#zgRvFDfc!gJW_W9p7R4CmOt^Y@}+eD0f_i~|{@JGZB# zJE-_|{z|mpy(*Ybo0k4e>Vs8~tdcP|4bfbWXG5>|AhgKEJh6HdgTF1G;1d~KG2N3C zeqT6$J@jvxEEzXavYMC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?d00001 diff --git a/02-array-seq/floats.txt b/02-array-seq/floats.txt new file mode 100644 index 0000000..61a3502 --- /dev/null +++ b/02-array-seq/floats.txt @@ -0,0 +1,1000 @@ +0.5672087234214661 +0.3715446464824773 +0.9029868933699332 +0.597517269261967 +0.9642962297374326 +0.018515854462267223 +0.7416735924040715 +0.6292252523526574 +0.12150062512732762 +0.6315546169266913 +0.6217331018897596 +0.028225823047060894 +0.9806590049090178 +0.28045334371652675 +0.8509347164428829 +0.22262897562818007 +0.0700621966006646 +0.9411975115295255 +0.5975112189700034 +0.6450108439934424 +0.7951875312012301 +0.442328037149186 +0.35478997568097614 +0.5797172049033996 +0.5346914987244815 +0.15053880616416593 +0.3236969813016155 +0.39070859039950234 +0.4091586362224361 +0.5468176238477975 +0.4285970710296697 +0.5571450916137568 +0.15989751759911264 +0.41625779804943397 +0.6565304624640009 +0.381565322655669 +0.6491243102845079 +0.432937514367877 +0.009790189064869725 +0.4240126603062243 +0.723269845691147 +0.7644553538749663 +0.30501489335107324 +0.836555563332 +0.3497478702711855 +0.8383245567143863 +0.09886292943429087 +0.5577417642865227 +0.23540977525641427 +0.4194712799588116 +0.6734420536802627 +0.5377115976100824 +0.40764072795800044 +0.9376036205604947 +0.8912588368503107 +0.7338801090115283 +0.5022603037204608 +0.28537081584581103 +0.5644117540638129 +0.8835046673920117 +0.8825612161324567 +0.13903269426799048 +0.7234868763234438 +0.8307316412902469 +0.8591555536672247 +0.045507173574899196 +0.8869849923431151 +0.014727613177594634 +0.0037283646787705793 +0.9734822693996291 +0.9127874764096242 +0.26712641946681837 +0.8352632887756127 +0.6912154058193811 +0.3619911737971031 +0.31925383678998054 +0.0759863270639386 +0.9925837649349452 +0.8242097031491457 +0.17698998037965052 +0.6652944917258016 +0.019878364698023288 +0.12424000792997625 +0.5691756900150098 +0.7610753473290672 +0.8110444549348631 +0.9645839037006322 +0.7254564692201676 +0.055830273875597025 +0.4273496938170155 +0.8297264009516345 +0.8823263082831994 +0.3631659574916666 +0.3616833975683762 +0.7124957307958676 +0.6908410101391399 +0.2166148325863475 +0.48044981508655826 +0.9749464938539415 +0.9965135417425971 +0.22614163699370637 +0.24389221853061127 +0.5152815050730025 +0.28049907389498985 +0.54108652505173 +0.7575222664597618 +0.19463801747067222 +0.7262641355599533 +0.17725246280880935 +0.9816960945420308 +0.9407042079443705 +0.45344430860634655 +0.5692409083167216 +0.5800727076752696 +0.642950045854989 +0.36886071137220733 +0.15401704790959592 +0.28034269793725697 +0.7997994808072422 +0.27964036916395496 +0.025059642751159017 +0.08476994183790154 +0.5156725789849962 +0.7797987535362827 +0.7981284885671378 +0.5503686815413241 +0.6203157566339338 +0.3899388430115429 +0.898184684950611 +0.35151340925147156 +0.4566915344602208 +0.5433037203991101 +0.8419195313773077 +0.27499065230242814 +0.8975395988187622 +0.09540329711723039 +0.5522658835153107 +0.20616884308157324 +0.22174049512690552 +0.7230521765051388 +0.10689053176751162 +0.8099758063891256 +0.2373940404118431 +0.09511034543435481 +0.12886324729286303 +0.07286799385263754 +0.12307712170368701 +0.3581737379677121 +0.3414749950438509 +0.43251173136056353 +0.1498674437242421 +0.1483930260980223 +0.1427115677761387 +0.33083986350894934 +0.6966638361024153 +0.2863191206095884 +0.8881416751028007 +0.8569558448568998 +0.3335637039982273 +0.6822655862460206 +0.0016784483678957685 +0.36644193955537685 +0.32704462865368233 +0.9599255774926685 +0.412338201708184 +0.035307417271688735 +0.8910837211520892 +0.4061312749480994 +0.4541877632062229 +0.8595753876724792 +0.005885419022495508 +0.5604632079399972 +0.8394726590592712 +0.8116935652447627 +0.4500603904690512 +0.7437467809712313 +0.5083723543215037 +0.2433483060157876 +0.8044544803211341 +0.9130554888055452 +0.8261397650631385 +0.9962310418221352 +0.9055222562383264 +0.9094124592521733 +0.48487912596704563 +0.9847759517796298 +0.19786814934810082 +0.2991360031937741 +0.011785247029307278 +0.11435883307977768 +0.8567018784398248 +0.6887660845108939 +0.4289713738556623 +0.0851301462554438 +0.5085554306063218 +0.5269212732902704 +0.043115112826294655 +0.37576114566011065 +0.53642963594576 +0.300774986347748 +0.46228772698085774 +0.27925780822852175 +0.9713744670308018 +0.14794170844990973 +0.4173029056797921 +0.5851598040502632 +0.7128422264036158 +0.07537805709181267 +0.06866196884157261 +0.1602499103131232 +0.22901698089191447 +0.20674172705141258 +0.5308130992411165 +0.9753041710607273 +0.21789128815244718 +0.44839220202981944 +0.7688971653768878 +0.44225012481289094 +0.850249398784862 +0.35030781025981883 +0.18086995571257258 +0.06348871128820466 +0.9686583066541333 +0.0037419956524294973 +0.6586597466040051 +0.9832822015383741 +0.8965302143911061 +0.9425490241393908 +0.7815759053597333 +0.9786948672764244 +0.6124681584953854 +0.45087639730911966 +0.39625372787769186 +0.22102523036841437 +0.18722589500478382 +0.6840195547381434 +0.12143469933213968 +0.5757597893215731 +0.16670692546531185 +0.7047320702679396 +0.040607154677028356 +0.4305933662717908 +0.2201138910880861 +0.2673030537016239 +0.5805882189205686 +0.5049734729089645 +0.6803878340661202 +0.36223494128541733 +0.45374751695565874 +0.1466809738299285 +0.3914127298792246 +0.22230614933572057 +0.03510159432299709 +0.8943830151936528 +0.5943885039160551 +0.8379754774518582 +0.012842671049460352 +0.18536925925443726 +0.21797921639948759 +0.7527543978642408 +0.23443737456792357 +0.000940242943913594 +0.31523077382879316 +0.5235299059725492 +0.22201137614635058 +0.20491057357662945 +0.9728620458127791 +0.37064253419793025 +0.7160135083328346 +0.09352838347380565 +0.30882692739054585 +0.2532879825819895 +0.21834186542099265 +0.31328798946279635 +0.9211697319526553 +0.8965426146947912 +0.8653647952033992 +0.34839758681058564 +0.13999176255344148 +0.954747472748305 +0.8213865904351656 +0.7353087213383943 +0.05293507671803588 +0.18928394491325828 +0.35663866312307635 +0.5635940875243229 +0.6826717634297086 +0.24961049579632655 +0.5113083759553145 +0.39035428378412507 +0.18478193164286472 +0.6597419571209191 +0.5956426019014396 +0.9718893673142627 +0.8806847571632049 +0.4926789279844227 +0.3051888002800478 +0.24799332262255724 +0.3759481831379463 +0.17633999428649172 +0.6936888599564529 +0.16530550321825166 +0.6025344178749164 +0.0551789181531438 +0.2641481639985547 +0.28451555274731855 +0.3310705746115199 +0.13028036961975176 +0.7487728053477253 +0.9357138254116824 +0.25277072158413594 +0.27945894431964147 +0.3269555568624475 +0.3209603541679118 +0.9243978729613413 +0.14401837577881305 +0.19111167203238177 +0.2306059817532189 +0.3772123036478402 +0.7016276161419842 +0.2425796892969334 +0.5746543920030653 +0.43396965475366367 +0.9688592835421302 +0.7666691365261079 +0.34592714992542617 +0.019562415498229346 +0.08119224908187062 +0.2083928921944651 +0.4814330290350195 +0.33480510357692717 +0.3402349440483783 +0.1394560685632068 +0.7769240828700293 +0.38147777003956196 +0.2328499782680632 +0.12218328891135355 +0.8684806364372117 +0.3745194711123515 +0.9193339066063804 +0.45017881639345736 +0.7841736777482041 +0.3251716676391142 +0.420990780080445 +0.30229134587325057 +0.5260700809875096 +0.13650474262718715 +0.887786029711926 +0.5645942173998904 +0.6204991605274727 +0.45172605268055166 +0.7041164148944846 +0.05004522005585588 +0.18945651439526445 +0.057562206593289145 +0.0005115898948883091 +0.94389370429751 +0.589841194966877 +0.8543970930407687 +0.1990752944362515 +0.7133657227802516 +0.4076584146275999 +0.42269758848542927 +0.1970377053142891 +0.18523529778341719 +0.23442218014112315 +0.020043958969856668 +0.8683888451420744 +0.8963084426055589 +0.6033003514240094 +0.7644020337974067 +0.1325551817366828 +0.6883403438928232 +0.0696770061004488 +0.7808712771900951 +0.8676233102752502 +0.7878527904342322 +0.5921161707261501 +0.028641208822538178 +0.9729290023262789 +0.3214807331424384 +0.8283270322046421 +0.25850658915835556 +0.9527280082076067 +0.27905690770843516 +0.8936357080649113 +0.5309486564073227 +0.7079588686356516 +0.9200323689617904 +0.7921248927383484 +0.0319615015197342 +0.27267019922571567 +0.9472194453616989 +0.9806628761543361 +0.987894719442812 +0.09323794320157663 +0.24854459139853313 +0.5499040635366669 +0.8053508806423493 +0.00232292526329958 +0.6965412340570454 +0.012522573211255272 +0.7536694680258196 +0.09945570214292376 +0.1810969765407452 +0.5492935325768823 +0.2845947517630274 +0.5642507658420168 +0.14777113424538157 +0.8517724428489523 +0.9227826253344183 +0.7591693803633006 +0.23577053541692894 +0.8472363932632425 +0.08456362587592392 +0.8165148666478764 +0.0696184594858521 +0.5545069339449122 +0.08490798936621391 +0.9951308555411419 +0.1746309226025935 +0.6740951689790556 +0.3787191301375179 +0.32809372189468633 +0.823314019530082 +0.3684171195579553 +0.6164208357485547 +0.5327032192886181 +0.548978731708661 +0.7780040435867366 +0.4886117035751838 +0.1707624385777612 +0.30421741310209616 +0.6722246625665227 +0.5481986466571327 +0.9472415912798465 +0.883825958788734 +0.21027946516823826 +0.08661186029689372 +0.49684074278708523 +0.14007021475996873 +0.7083779696400403 +0.8479151853620545 +0.6856816239358936 +0.8923499467878472 +0.592411774166396 +0.7672436591642403 +0.488531004783722 +0.33574907051610314 +0.08143763461836018 +0.9779152408831796 +0.7272743889343076 +0.7843657344096894 +0.8481414592588526 +0.9864949677692165 +0.5469487833963597 +0.6788032440961776 +0.8583250544661369 +0.09924199353703766 +0.2678308916990313 +0.6449379134071719 +0.025275384181633 +0.43261714492129477 +0.9192994882012687 +0.8339528914173123 +0.5240140916454521 +0.24093312996021032 +0.9438637438290468 +0.7396290574542499 +0.013131189771496299 +0.5647607406261114 +0.6756706915357087 +0.31728622429134334 +0.6144836080320213 +0.644657270270597 +0.2910285708650291 +0.5246617968752164 +0.6986064449725015 +0.1321565316914567 +0.8054049853864302 +0.2772005436454589 +0.09777918457958157 +0.2576629652930018 +0.8060203066883604 +0.41817124838371944 +0.26660742102248147 +0.7996487328351803 +0.8273186027967936 +0.3368945679348331 +0.6636192464869416 +0.605438062901539 +0.8307441405748424 +0.6260878742193361 +0.3453849416416941 +0.5479210336626454 +0.6480455612057998 +0.43113474229236926 +0.17111883891617008 +0.18319479185067378 +0.18542196774572273 +0.2962205215175151 +0.4108841091337443 +0.44157975330024146 +0.5013792676836784 +0.8534468250098285 +0.06046874751764886 +0.8618583621737542 +0.09012840069930739 +0.575975630651307 +0.08946068169856347 +0.49515146013980593 +0.6335789251211986 +0.019834606076390537 +0.2608277514506334 +0.22542186406218578 +0.6789536514293729 +0.7206310512224415 +0.35400499447830847 +0.7733601895541559 +0.996926713307083 +0.5131069267348308 +0.4826615688242082 +0.7348117894458732 +0.962588855152077 +0.17914221384935192 +0.5429065123578606 +0.7783039578056946 +0.41049772366070403 +0.5319830910127553 +0.6567198269280179 +0.18881863148140454 +0.330894828262982 +0.20935593018600673 +0.4030128855488849 +0.6338171215656808 +0.22568735670651485 +0.49621900466960034 +0.459613022411537 +0.5258813275558797 +0.4447593401836062 +0.46551003131965896 +0.3621940864960329 +0.3088065037219192 +0.8595173703964389 +0.36227388836250374 +0.029312166594182232 +0.6845180734234009 +0.3571744045676982 +0.6463658294916057 +0.7655555733777909 +0.026600800322377438 +0.9592942503216108 +0.4385866108117106 +0.6492303703324658 +0.4338807452614516 +0.5148932754644271 +0.6858735119905685 +0.21799034739580725 +0.9241085630742619 +0.040584629103344594 +0.7466535170169162 +0.4601675251741725 +0.21161390213812536 +0.7556392953469002 +0.8794469235324798 +0.9409815849271733 +0.12592657675645513 +0.039080375525831546 +0.40802046384789104 +0.5768411126134482 +0.392240738984716 +0.39334835045731653 +0.8732451913120117 +0.5595923685418662 +0.9897925075287934 +0.32831394148568993 +0.49704451940611116 +0.9197565938894192 +0.35727118821612025 +0.6245145361494547 +0.2947976257566278 +0.5926220803949815 +0.7394447554730054 +0.7054846018211152 +0.09741589429963271 +0.5729450003820947 +0.9427832031186616 +0.1829287768765131 +0.9632623316167594 +0.7171405266188611 +0.9886222739606412 +0.25265521107540845 +0.6227289071079649 +0.6309545842364322 +0.14369962915205003 +0.4164850892249059 +0.22619395434286138 +0.18726869568595883 +0.01042432554441275 +0.11090654603095018 +0.9116693323830063 +0.26538448943303317 +0.4705515031089387 +0.24880100700625052 +0.9870730058863542 +0.20926481997671564 +0.34588061282287763 +0.46749466284658747 +0.11585340097673946 +0.3226005260939362 +0.9932215666478221 +0.5114957824253362 +0.9955389844299418 +0.5400258633163912 +0.3993067425752538 +0.9152972502796715 +0.022001299527051432 +0.1989998234202458 +0.9382524733570571 +0.5779353591404234 +0.9704156578573686 +0.7281099600265879 +0.520084506525035 +0.6540579936356459 +0.5126368862072903 +0.20774913520811822 +0.7158044664237553 +0.923291852560841 +0.7694755512452165 +0.8558606084919893 +0.10607572849266311 +0.7603615121261182 +0.021851436949285152 +0.06645977370883438 +0.03380581421602946 +0.30711402698982226 +0.648384047657449 +0.7987828338134668 +0.718440819245824 +0.23973944618466525 +0.7416032811768923 +0.016699274446843604 +0.3323436291709728 +0.4316462182621047 +0.6138114621642724 +0.8822826619174486 +0.3353174521547625 +0.41544340965728077 +0.7742673934591305 +0.17450788432095676 +0.13005791916927623 +0.9736986374533545 +0.23125564123538722 +0.696819051721944 +0.728984442006048 +0.8079581248124904 +0.46978389873709436 +0.002832801027870646 +0.8964065524666706 +0.316074250328074 +0.9840933833302111 +0.3715054791577663 +0.41535375916262174 +0.1957939562719645 +0.05433229533679107 +0.2159228748360229 +0.2850456723616016 +0.4879331980619529 +0.9350604501355557 +0.9774393056487175 +0.032306613732547285 +0.9590333040920729 +0.1592274862276153 +0.45502956289803453 +0.965960510601904 +0.5320628033209552 +0.2357968349543721 +0.5972460362589005 +0.48631985573699354 +0.8905849460570637 +0.9247217912113445 +0.9190894697075259 +0.19408616563994063 +0.27944650413081207 +0.875786696583241 +0.7114577474526346 +0.9782034016607003 +0.4357897218592668 +0.50527381282535 +0.4382698248601741 +0.39661490132403143 +0.8392314949726573 +0.128176421627742 +0.6289775352177489 +0.12040940474008022 +0.2484297444783541 +0.7946851252699818 +0.40509498030250657 +0.032200229315239914 +0.7876880776040891 +0.672228854343781 +0.6535275478055009 +0.4071825501937183 +0.6894851647279617 +0.6970938573724043 +0.45047762839052286 +0.32413817379769083 +0.2331346183888463 +0.3241452370287249 +0.4979188278445492 +0.39144214341421657 +0.49865244898379146 +0.2848206929705278 +0.7560413304019347 +0.8624032533724059 +0.7847523931703649 +0.13504898801686505 +0.7054432057752753 +0.478713535052838 +0.8875124781105602 +0.24891690795521892 +0.8500338554344936 +0.7388836799664502 +0.048419986398996806 +0.519774790218875 +0.06075326185066521 +0.5924045765982915 +0.7759871319286726 +0.9756606090031102 +0.28733001220704824 +0.034532424630923875 +0.9982410662824659 +0.7737085866830513 +0.8044817598640611 +0.6343991390922598 +0.17296922368686063 +0.5350910042217434 +0.179079915573786 +0.8278965781691721 +0.529432682858147 +0.994099661208408 +0.04186778808389602 +0.3129601414469534 +0.7638248328228557 +0.4814878112759954 +0.7939784644723199 +0.33957731458823537 +0.9146789644915825 +0.5224440305539688 +0.9310950418636873 +0.38611350478995454 +0.264000081625951 +0.9065600467122011 +0.9174089185458028 +0.7830566269165662 +0.04725492448313551 +0.01920064204639671 +0.11660236258104306 +0.2771499502488458 +0.8352306010911253 +0.05428376454398953 +0.23161854690564299 +0.20266368851396077 +0.9733478258263121 +0.3055610895075097 +0.12577003490240346 +0.6665319927326261 +0.20308921328407614 +0.6256199449212814 +0.9811390490942644 +0.6642460977511329 +0.6930845123258408 +0.0058338698309746695 +0.9967574500231288 +0.8563457402073394 +0.31200998221852794 +0.8492017505533931 +0.02095774332753808 +0.42778662755090324 +0.027186744105201943 +0.7334507784613264 +0.6490537172020329 +0.6215088786254813 +0.43442149033222344 +0.040931337304090265 +0.8664809705741733 +0.5472835473989529 +0.546300391718062 +0.3849323564601397 +0.11675336844455741 +0.8572138757974119 +0.7897586052500741 +0.8331443636468118 +0.4637120086588029 +0.5833230826090611 +0.15755383003278922 +0.8796287757764542 +0.6750302859428917 +0.25440937614853754 +0.8290304146507526 +0.858294465506999 +0.6337115428024199 +0.15878158455411562 +0.2978051252432966 +0.0318929449162062 +0.5004451287010717 +0.6782034085018531 +0.48992208991252484 +0.8248902042010355 +0.7455984801536288 +0.9209703503322801 +0.5704745959980548 +0.8055378191933936 +0.7073567393131684 +0.07223156519904672 +0.4250744852720072 +0.8265116039250776 +0.5284673514016857 +0.3907059151447191 +0.09480233233937985 +0.07554140824071176 +0.20376915750401658 +0.5422863303914044 +0.9711721072758638 +0.2719816372744105 +0.2999234737500053 +0.9104736968808406 +0.17572130504435657 +0.19280221298204403 +0.6562965621039506 +0.17522961734232567 +0.09290337797890247 +0.8354610885185727 +0.9556915183352701 +0.8555688868096656 +0.8837239819759596 +0.0001379576679138017 +0.947012914241853 +0.03404468070592903 +0.11566672681993084 +0.8220665806683864 +0.662219420381477 +0.7308848334052779 +0.367385079077283 +0.17495769377321724 +0.7226545936070774 +0.21416446897906483 +0.9865952431680558 +0.027576949925289473 +0.19726119696052435 +0.3199772093337848 +0.670988283568863 +0.41122710945284346 +0.521337316732732 +0.8279870261687592 +0.30012625699977147 +0.9008735804035131 +0.3542572384151961 +0.48003069477725857 +0.5296854760022498 +0.5172505959916757 +0.7662473367714318 +0.3696636167042797 +0.8373483627640302 +0.0663331304028707 +0.20190996365029146 +0.6698165916451687 +0.9973928708439379 +0.9645139588277621 +0.5797032352937731 +0.7782965812348129 +0.8739483985899543 +0.3474662093325931 +0.3044727187392616 +0.72240183481003 +0.9366136567769461 +0.3345834912186014 +0.15763543189820117 +0.17347833493549258 +0.20817834581503902 +0.041256092715594384 +0.5866878122762447 +0.321331581373827 +0.3834993313375602 +0.10744511935402301 +0.48059423369674104 +0.67864332288794 +0.9074886767149931 +0.9971394346174389 +0.4718029091404867 +0.22319890328954872 +0.828669540791471 +0.28402147315241966 +0.5259346182354092 +0.8861893383793763 +0.06740407073087695 +0.9916472862574137 +0.5861193723845862 +0.28273734445205523 +0.5673817368785079 +0.9642260348234428 +0.9006935266826296 +0.3823226475867384 +0.7135327713884919 +0.6848870964569306 +0.1824824764783778 +0.17323932200081404 +0.6968526888715102 +0.41804453420545606 +0.6777519014955855 +0.14042840790717181 +0.5170035548595866 +0.7514308753092891 +0.5826095570746332 +0.612258057316104 +0.6177919026108166 +0.619017673865854 +0.63948489597244 +0.7412024227137837 +0.6282763162166608 +0.10312396814182645 +0.1138446092081341 +0.17041214594830645 +0.7766915065236526 +0.4541168411474126 +0.7917765396460701 +0.6203072101081253 +0.16775520855257275 +0.7779851529091911 +0.22148636936004895 +0.05493065916066309 +0.06907235896918695 +0.1543799633975298 +0.6621320385623942 +0.6492181303685314 +0.8545728965719739 +0.6615011185358145 +0.3229447272454157 +0.9517990260688887 +0.18296391467015383 +0.9112099867971957 +0.11307769729523809 +0.5446838176256797 +0.39310049662181046 +0.7591835581993036 +0.6510640411425068 +0.9669614373419594 +0.33504144672014424 +0.46899564925141624 +0.37643901501841004 +0.6006811011720938 +0.8589013207527408 +0.7589719305676297 +0.3247453490131832 +0.034638088053816074 +0.8896823211311813 +0.4622252152645787 +0.7634792290105328 +0.5559386225819801 +0.482494280839853 +0.4648556393406803 +0.23385178919992478 +0.6740840338402068 +0.494779691712927 +0.4084557649050422 +0.27678182127452 +0.13714402832059425 +0.18198509269310237 +0.7579117598368394 +0.030286174627052187 +0.7121951007915013 +0.23217582447396146 +0.7960126439340683 +0.5420716572256754 +0.6210869315961701 +0.6651043518815413 +0.37074461928654023 +0.8270398036333397 +0.5092516438785792 +0.44852712661666294 +0.786958847635865 +0.22156754285384428 +0.34218737959138956 +0.05912098513219732 +0.7796407931303314 +0.42422803263464226 +0.7435098904848829 +0.5641917320420474 +0.7754392437080894 +0.4218167972949217 +0.8788320755140397 +0.5349003957683597 +0.20935444679962656 +0.8421959939884889 +0.6923905131902395 +0.9008483831232639 +0.7670283071159404 +0.8773814819011445 +0.456172590073069 +0.917207419997926 From 02acaf33b3af37eb053d0ef4bbc8cf6f5f90439d Mon Sep 17 00:00:00 2001 From: huayongpan Date: Fri, 26 Oct 2018 11:55:21 +0800 Subject: [PATCH 17/26] Add example 4 10 --- 04-text-byte/example_4_10.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/04-text-byte/example_4_10.py b/04-text-byte/example_4_10.py index 26fbfa8..d36fcf0 100644 --- a/04-text-byte/example_4_10.py +++ b/04-text-byte/example_4_10.py @@ -1,11 +1,15 @@ fp = open('cafe.txt', 'w', encoding='utf-8') print(fp) +# <_io.TextIOWrapper name='cafe.txt' mode='w' encoding='utf-8'> +# 默认情况下,open函数采用文本模式,返回一个TextIOWrapper对象 print(fp.write('café')) +# 在TextIOWrapper对象上调用write方法返回写入的Unicode字符数:4 fp.close() import os print(os.stat('cafe.txt').st_size) fp2 = open('cafe.txt') print(fp2) +# 返回一个TextIOWrapper对象,编码是区域设置中的默认值 print(fp2.encoding) print(fp2.read()) fp.close() @@ -15,5 +19,7 @@ fp3.close() fp4 = open('cafe.txt', 'rb') print(fp4) +# 'rb'标识指明在二进制模式中读取文件 +# 返回的是BufferedReader对象,而不是TextIOWrapper对象 print(fp4.read()) fp4.close() From e297c0cd45c148c231c828af5e0f07a21735421a Mon Sep 17 00:00:00 2001 From: huayongpan Date: Sat, 27 Oct 2018 17:07:45 +0800 Subject: [PATCH 18/26] Add example 4 11 --- 04-text-byte/example_4_11.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 04-text-byte/example_4_11.py diff --git a/04-text-byte/example_4_11.py b/04-text-byte/example_4_11.py new file mode 100644 index 0000000..91cd876 --- /dev/null +++ b/04-text-byte/example_4_11.py @@ -0,0 +1,6 @@ +import sys, locale + +expressions = """ + locale.getpreferredencoding() + type(my_file) +""" \ No newline at end of file From 18ba6ed5cee8bd0b2e3ccab336a6e59c88257c60 Mon Sep 17 00:00:00 2001 From: huayongpan Date: Mon, 29 Oct 2018 10:11:29 +0800 Subject: [PATCH 19/26] Add the rest codes to example_4_11 --- 04-text-byte/example_4_11.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/04-text-byte/example_4_11.py b/04-text-byte/example_4_11.py index 91cd876..0976071 100644 --- a/04-text-byte/example_4_11.py +++ b/04-text-byte/example_4_11.py @@ -3,4 +3,18 @@ expressions = """ locale.getpreferredencoding() type(my_file) -""" \ No newline at end of file + my_file.encoding + sys.stdout.isatty() + sys.stdout.encoding + sys.stdin.isatty() #是否输出到控制台 + sys.stdin.encoding + sys.stderr.isatty() + sys.stderr.encoding + sys.getdefaultencoding() + sys.getfilesystemencoding() +""" + +my_file = open('dummy', 'w') +for expression in expressions.split(): + value = eval(expression) + print(expression.rjust(30), '->', repr(value)) \ No newline at end of file From 34650adc5f09158db6846d49a8cc2b00faf1b35b Mon Sep 17 00:00:00 2001 From: huayongpan Date: Fri, 2 Nov 2018 10:13:03 +0800 Subject: [PATCH 20/26] Add example 4 14 --- 04-text-byte/example_4_14.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 04-text-byte/example_4_14.py diff --git a/04-text-byte/example_4_14.py b/04-text-byte/example_4_14.py new file mode 100644 index 0000000..4906544 --- /dev/null +++ b/04-text-byte/example_4_14.py @@ -0,0 +1,11 @@ +import unicodedata +import string + +def shave_marks(txt): + """drop all makrs""" + norm_txt = unicodedata.normalize('NFD', txt) + shaved = ''.join(c for c in norm_txt if not unicodedata.combining(c)) + return unicodedata.normalize('NFC', shaved) + +if __name__ == '__main__': + print(shave_marks('cafe\u0301')) From a310b26cc18476c9694377f529583a8aa44adcaf Mon Sep 17 00:00:00 2001 From: huayongpan Date: Tue, 6 Nov 2018 18:01:01 +0800 Subject: [PATCH 21/26] Add example 5 8 --- 05-1class-func/example_5_8.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 05-1class-func/example_5_8.py diff --git a/05-1class-func/example_5_8.py b/05-1class-func/example_5_8.py new file mode 100644 index 0000000..0be1992 --- /dev/null +++ b/05-1class-func/example_5_8.py @@ -0,0 +1,22 @@ +import random + +class BingoCage: + def __init__(self, items): + self._items = list(items) + random.shuffle(self._items) + + def pick(self): + try: + return self._items.pop() + except IndexError: + raise LookupError('pick from empty BingoCage') + + def __call__(self): + return self.pick() + + +if __name__ == '__main__': + bingo = BingoCage(range(3)) + print(bingo.pick()) + print(bingo()) + print(callable(bingo)) \ No newline at end of file From 65d9b721fad67f6f8dcbb4209b654b7dc0676b02 Mon Sep 17 00:00:00 2001 From: huayongpan Date: Mon, 12 Nov 2018 17:59:55 +0800 Subject: [PATCH 22/26] Add example 5-5,6,23,24,26 --- 05-1class-func/example_5_23.py | 55 ++++++++++++++++++++++++++++++++++ 05-1class-func/example_5_24.py | 34 +++++++++++++++++++++ 05-1class-func/example_5_26.py | 5 ++++ 05-1class-func/example_5_5.py | 11 +++++++ 05-1class-func/example_5_6.py | 5 ++++ 5 files changed, 110 insertions(+) create mode 100644 05-1class-func/example_5_23.py create mode 100644 05-1class-func/example_5_24.py create mode 100644 05-1class-func/example_5_26.py create mode 100644 05-1class-func/example_5_5.py create mode 100644 05-1class-func/example_5_6.py diff --git a/05-1class-func/example_5_23.py b/05-1class-func/example_5_23.py new file mode 100644 index 0000000..b519886 --- /dev/null +++ b/05-1class-func/example_5_23.py @@ -0,0 +1,55 @@ +metro_data = [ + ('Tokyo', 'JP', 36.933, (35.6897222, 139.691667)), + ('Delhi NCR', 'IN', 21.935, (28.613889, 77.208889)), + ('Mexico City', 'MX', 20.142, (19.433333, -99.1333333)), + ('New York-Newark', 'US', 20.104, (40.808611, -74.020386)), + ('Sao Paulo', 'BR', 19.649, (-23.547778, -46.635833)), +] +from operator import itemgetter +for city in sorted(metro_data, key=itemgetter(1)): + print(city) + +''' +Output: + ('Sao Paulo', 'BR', 19.649, (-23.547778, -46.635833)) + ('Delhi NCR', 'IN', 21.935, (28.613889, 77.208889)) + ('Tokyo', 'JP', 36.933, (35.6897222, 139.691667)) + ('Mexico City', 'MX', 20.142, (19.433333, -99.1333333)) + ('New York-Newark', 'US', 20.104, (40.808611, -74.020386)) + +''' + +cc_name = itemgetter(1, 0) +for city in metro_data: + print(cc_name(city)) + +''' +Output: +('JP', 'Tokyo') +('IN', 'Delhi NCR') +('MX', 'Mexico City') +('US', 'New York-Newark') +('BR', 'Sao Paulo') + +''' +list_people = [ + {'name': 'Mike', 'age': 22, 'score': 90}, + {'name': 'Alice', 'age': 22, 'score': 90}, + {'name': 'Lee', 'age': 26, 'score': 92}, + {'name': 'Ben', 'age': 26, 'score': 85}, + {'name': 'Tom', 'age': 33, 'score': 90}, + {'name': 'Jill', 'age': 41, 'score': 72} +] + +for person in sorted(list_people, key = itemgetter('age', 'name')): + print(person) + +''' +Output: +{'name': 'Alice', 'score': 90, 'age': 22} +{'name': 'Mike', 'score': 90, 'age': 22} +{'name': 'Ben', 'score': 85, 'age': 26} +{'name': 'Lee', 'score': 92, 'age': 26} +{'name': 'Tom', 'score': 90, 'age': 33} +{'name': 'Jill', 'score': 72, 'age': 41} +''' \ No newline at end of file diff --git a/05-1class-func/example_5_24.py b/05-1class-func/example_5_24.py new file mode 100644 index 0000000..2bac983 --- /dev/null +++ b/05-1class-func/example_5_24.py @@ -0,0 +1,34 @@ +from collections import namedtuple + +metro_data = [ + ('Tokyo', 'JP', 36.933, (35.6897222, 139.691667)), + ('Delhi NCR', 'IN', 21.935, (28.613889, 77.208889)), + ('Mexico City', 'MX', 20.142, (19.433333, -99.1333333)), + ('New York-Newark', 'US', 20.104, (40.808611, -74.020386)), + ('Sao Paulo', 'BR', 19.649, (-23.547778, -46.635833)), +] + + +LatLong = namedtuple('LatLong', 'lat long') +Metropolis = namedtuple('Metropolis', 'name cc pop coord') + +metro_areas = [Metropolis(name, cc, pop, LatLong(lat, long)) + for name, cc, pop, (lat, long) in metro_data] + +print(metro_areas[0]) +print(metro_areas[0].coord.lat) +#Output: Metropolis(name='Tokyo', cc='JP', pop=36.933, coord=LatLong(lat=35.6897222, long=139.691667)) +# 35.6897222 + +from operator import attrgetter +name_lat = attrgetter('name', 'coord.lat') +for city in sorted(metro_areas, key=attrgetter('coord.lat')): + print(name_lat(city)) +''' +Output: +('Sao Paulo', -23.547778) +('Mexico City', 19.433333) +('Delhi NCR', 28.613889) +('Tokyo', 35.6897222) +('New York-Newark', 40.808611) +''' \ No newline at end of file diff --git a/05-1class-func/example_5_26.py b/05-1class-func/example_5_26.py new file mode 100644 index 0000000..8c43498 --- /dev/null +++ b/05-1class-func/example_5_26.py @@ -0,0 +1,5 @@ +from operator import mul +from functools import partial + +triple = partial(mul, 3) +print(triple(7)) \ No newline at end of file diff --git a/05-1class-func/example_5_5.py b/05-1class-func/example_5_5.py new file mode 100644 index 0000000..ae2b48b --- /dev/null +++ b/05-1class-func/example_5_5.py @@ -0,0 +1,11 @@ +def factorial(n): + return 1 if n < 2 else n * factorial(n-1) + +print(list(map(factorial, range(6)))) +# [1, 1, 2, 6, 24, 120] +print([factorial(n) for n in range(6)]) +# [1, 1, 2, 6, 24, 120] +print(list(map(factorial, filter(lambda n: n%2, range(6))))) +# [1, 6, 120] +print([factorial(n) for n in range(6) if n % 2]) +# [1, 6, 120] \ No newline at end of file diff --git a/05-1class-func/example_5_6.py b/05-1class-func/example_5_6.py new file mode 100644 index 0000000..f96dab1 --- /dev/null +++ b/05-1class-func/example_5_6.py @@ -0,0 +1,5 @@ +from functools import reduce +from operator import add + +print(reduce(add, range(100))) +print(sum(range(100))) \ No newline at end of file From 93f91ec4a39ce40294fd98e52a9dd726443ee90c Mon Sep 17 00:00:00 2001 From: huayp Date: Tue, 13 Nov 2018 17:02:35 +0800 Subject: [PATCH 23/26] Add chapter 6 examples --- 06-dp-1class-func/example_6_1.py | 86 ++++++++++++++++++++++++++++++++ 06-dp-1class-func/example_6_3.py | 73 +++++++++++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 06-dp-1class-func/example_6_1.py create mode 100644 06-dp-1class-func/example_6_3.py diff --git a/06-dp-1class-func/example_6_1.py b/06-dp-1class-func/example_6_1.py new file mode 100644 index 0000000..56aa89f --- /dev/null +++ b/06-dp-1class-func/example_6_1.py @@ -0,0 +1,86 @@ +from abc import ABC, abstractmethod +from collections import namedtuple + +Customer = namedtuple('Customer', 'name fidelity') + +class LineItem: + def __init__(self, product, quantity, price): + self.product = product + self.quantity = quantity + self.price = price + + def total(self): + return self.price * self.quantity + +class Order: + def __init__(self, customer, cart, promotion=None): + self.customer = customer + self.cart = list(cart) + self.promotion = promotion + + def total(self): + if not hasattr(self, '__total'): + self.__total = sum(item.total() for item in self.cart) + return self.__total + + def due(self): + if self.promotion is None: + discount = 0 + else: + discount = self.promotion.discount(self) + return self.total() - discount + + def __repr__(self): + fmt = '' + return fmt.format(self.total(), self.due()) + +""" +把Promotion定义为抽象基类 Abstract Base Class, ABC +为了使用@Abstractmentod装饰器,从而表明所用的模式 +""" +class Promotion(ABC): + @abstractmethod + def discount(self, order): + """返回折扣金额>0""" + + +class FidelityPromo(Promotion): + """积分>=1000的顾客提供5%折扣""" + def discount(self, order): + return order.total() * 0.05 if order.customer.fidelity >= 1000 else 0 + +class BulkItemPromo(Promotion): + """单个商品为20个及以上时提供10%折扣""" + def discount(self, order): + discount = 0 + for item in order.cart: + if item.quantity >= 20: + discount += item.total() * 0.1 + return discount + +class LargeOrderPromo(Promotion): + """订单中的不同商品达到10个或以上时提供7%折扣""" + def discount(self, order): + distinct_items = {item.product for item in order.cart} + if len(distinct_items) >= 10: + return order.total() * 0.07 + return 0 + + +if __name__ == '__main__': + joe = Customer('John Doe', 0) + ann = Customer('Ann Smith', 1100) + cart = [LineItem('banana', 4, 0.5), + LineItem('apple', 10, 1.5), + LineItem('watermellon', 5, 5.0)] + fidelityPromo_instance = Order(joe, cart, FidelityPromo()) + print(fidelityPromo_instance) + fidelityPromo_instance = Order(ann, cart, FidelityPromo()) + print(fidelityPromo_instance) + banana_cart = [LineItem('banan', 30, 0.5), + LineItem('apple', 10, 1.5)] + print(Order(joe, banana_cart, BulkItemPromo())) + long_order = [ LineItem(str(item_code), 1, 1.0) + for item_code in range(10) ] + print(Order(joe, long_order, LargeOrderPromo())) + print(Order(joe, cart, LargeOrderPromo())) \ No newline at end of file diff --git a/06-dp-1class-func/example_6_3.py b/06-dp-1class-func/example_6_3.py new file mode 100644 index 0000000..1fb0ba8 --- /dev/null +++ b/06-dp-1class-func/example_6_3.py @@ -0,0 +1,73 @@ +from collections import namedtuple + +Customer = namedtuple('Customer', 'name fidelity') + +class LineItem: + def __init__(self, product, quantity, price): + self.product = product + self.quantity = quantity + self.price = price + + def total(self): + return self.price * self.quantity + +class Order: + def __init__(self, customer, cart, promotion=None): + self.customer = customer + self.cart = list(cart) + self.promotion = promotion + + def total(self): + if not hasattr(self, '__total'): + self.__total = sum(item.total() for item in self.cart) + return self.__total + + def due(self): + if self.promotion is None: + discount = 0 + else: + discount = self.promotion(self) + return self.total() - discount + + def __repr__(self): + fmt = '' + return fmt.format(self.total(), self.due()) + + +def fidelity_promo(order): + """积分>=1000的顾客提供5%折扣""" + return order.total() * 0.05 if order.customer.fidelity >= 1000 else 0 + +def bulk_item_promo(order): + """单个商品为20个及以上时提供10%折扣""" + discount = 0 + for item in order.cart: + if item.quantity >= 20: + discount += item.total() * 0.1 + return discount + +def large_order_promo(order): + """订单中的不同商品达到10个或以上时提供7%折扣""" + distinct_items = {item.product for item in order.cart} + if len(distinct_items) >= 10: + return order.total() * 0.07 + return 0 + + +if __name__ == '__main__': + joe = Customer('John Doe', 0) + ann = Customer('Ann Smith', 1100) + cart = [LineItem('banana', 4, 0.5), + LineItem('apple', 10, 1.5), + LineItem('watermellon', 5, 5.0)] + fidelityPromo_instance = Order(joe, cart, fidelity_promo) + print(fidelityPromo_instance) + fidelityPromo_instance = Order(ann, cart, fidelity_promo) + print(fidelityPromo_instance) + banana_cart = [LineItem('banan', 30, 0.5), + LineItem('apple', 10, 1.5)] + print(Order(joe, banana_cart, bulk_item_promo)) + long_order = [ LineItem(str(item_code), 1, 1.0) + for item_code in range(10) ] + print(Order(joe, long_order, large_order_promo)) + print(Order(joe, cart, large_order_promo)) \ No newline at end of file From 8483b6a91052236e5249e34830e86448ef72fc4a Mon Sep 17 00:00:00 2001 From: huayongpan Date: Fri, 23 Nov 2018 14:26:06 +0800 Subject: [PATCH 24/26] Add example 9-4 --- 09-pythonic-obj/example_9_4.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 09-pythonic-obj/example_9_4.py diff --git a/09-pythonic-obj/example_9_4.py b/09-pythonic-obj/example_9_4.py new file mode 100644 index 0000000..b14db88 --- /dev/null +++ b/09-pythonic-obj/example_9_4.py @@ -0,0 +1,27 @@ +''' +Compare classmethod and staticmethod +''' + +class Demo: + @classmethod + def klassmeth(*args): + return args + + @staticmethod + def statmeth(*args): + return args + + +if __name__ == '__main__': + print(Demo.klassmeth()) + print(Demo.klassmeth('spam')) + print(Demo.statmeth()) + print(Demo.statmeth('spam')) + +''' +Output: + (,) + (, 'spam') + () + ('spam',) +''' \ No newline at end of file From 85231871b7573dba41ee037c33031f51d0a45bb4 Mon Sep 17 00:00:00 2001 From: huayongpan Date: Fri, 23 Nov 2018 14:27:39 +0800 Subject: [PATCH 25/26] Add clock deco 2 --- 07-closure-deco/clockdeco2.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 07-closure-deco/clockdeco2.py diff --git a/07-closure-deco/clockdeco2.py b/07-closure-deco/clockdeco2.py new file mode 100644 index 0000000..8ea5f7d --- /dev/null +++ b/07-closure-deco/clockdeco2.py @@ -0,0 +1,32 @@ +# clockdeco2.py + +import time +import functools + + +def clock(func): + @functools.wraps(func) + def clocked(*args, **kwargs): + t0 = time.time() + result = func(*args, **kwargs) + elapsed = time.time() - t0 + name = func.__name__ + arg_lst = [] + if args: + arg_lst.append(', '.join(repr(arg) for arg in args)) + if kwargs: + pairs = ['%s=%r' % (k, w) for k, w in sorted(kwargs.items())] + arg_lst.append(','.join(pairs)) + arg_str = ','.join(arg_lst) + print('[%0.8fs] %s(%s) -> %r' % (elapsed, name, arg_str, result)) + return result + return clocked + + +@clock +def f1(a, b, c = 3): + return a + b + c + +if __name__ == '__main__': + f1(10, 100, c = 1) + f1(10, 100, c=1000) \ No newline at end of file From 07577e3e3ca822ab0e769bbaa22477fd988edb36 Mon Sep 17 00:00:00 2001 From: huayongpan Date: Mon, 10 Dec 2018 09:22:41 +0800 Subject: [PATCH 26/26] Add some examples --- 07-closure-deco/example_7_14.py | 16 ++++++++++++++++ 16-coroutine/example_16_1.py | 8 ++++++++ 16-coroutine/example_16_2.py | 26 ++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 07-closure-deco/example_7_14.py create mode 100644 16-coroutine/example_16_1.py create mode 100644 16-coroutine/example_16_2.py diff --git a/07-closure-deco/example_7_14.py b/07-closure-deco/example_7_14.py new file mode 100644 index 0000000..8cc6082 --- /dev/null +++ b/07-closure-deco/example_7_14.py @@ -0,0 +1,16 @@ +def make_averager(): + count = 0 + total = 0 + + def averager(new_value): + nonlocal count, total + count += 1 + total += new_value + return total/count + return averager + +if __name__ == '__main__': + avg = make_averager() + print(avg(10)) + print(avg(11)) + print(avg(12)) \ No newline at end of file diff --git a/16-coroutine/example_16_1.py b/16-coroutine/example_16_1.py new file mode 100644 index 0000000..67cbdb5 --- /dev/null +++ b/16-coroutine/example_16_1.py @@ -0,0 +1,8 @@ +def simple_coroutine(): + print('-> coroutine started') + x = yield + print('-> coroutine received: ', x) + +my_coro = simple_coroutine() +next(my_coro) +my_coro.send(42) \ No newline at end of file diff --git a/16-coroutine/example_16_2.py b/16-coroutine/example_16_2.py new file mode 100644 index 0000000..c7936c3 --- /dev/null +++ b/16-coroutine/example_16_2.py @@ -0,0 +1,26 @@ +def simple_coro2(a): + print('-> Started: a=', a) + b = yield a + print('-> Received: b= ', b) + c = yield a + b + print('-> Received: c=', c) + +my_coro2 = simple_coro2(14) +from inspect import getgeneratorstate +print(getgeneratorstate(my_coro2)) +# GEN_CREATED +print(next(my_coro2)) +# -> Started: a= 14 +# 14 +print(getgeneratorstate(my_coro2)) +# GEN_SUSPENDED +print(my_coro2.send(28)) +# -> Received: b= 28 +# 42 +print(my_coro2.send(99)) +# -> Received: c= 99 +# Traceback (most recent call last): +# ... +# StopIteration +print(getgeneratorstate(my_coro2)) +# GEN_CLOSED