From b74842a24795c82f125e26440e7de7c9293fb3d9 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Mon, 21 Dec 2020 23:18:08 +0800 Subject: [PATCH 1/5] week class3 --- ...50\347\254\254\344\270\211\350\257\276.py" | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\200\345\221\250\347\254\254\344\270\211\350\257\276.py" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\200\345\221\250\347\254\254\344\270\211\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\200\345\221\250\347\254\254\344\270\211\350\257\276.py" new file mode 100644 index 00000000..c90c7ba7 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\270\200\345\221\250\347\254\254\344\270\211\350\257\276.py" @@ -0,0 +1,19 @@ +aa = True +bb = b'hello world!' +cc = None + +a = [3, 3.14, 'hello world', aa, bb, cc] +b = (3, 3.14, 'hello world', aa, bb, cc) +c = { + "a01":3, + "a02":3.14, + "a03":'hello world', + "a04":aa, + "a05":bb, + "a06":cc, +} +d = {3, 3.14, 'hello world', aa, bb, cc} +print(a) +print(b) +print(c) +print(d) -- Gitee From 71bda5c92292fa4f6605fb7c9b031e2b9a211641 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Wed, 23 Dec 2020 20:10:28 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...50\347\254\254\344\270\200\350\257\276.py" | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" new file mode 100644 index 00000000..44f74e8b --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" @@ -0,0 +1,53 @@ + +#加法运算 +def add(a, b): + c = a+b + return c + +result = add(2, 5) +print(result) + + +#减法运算 +def sub(a, b): + c = a-b + return c + +result=sub(8, 5) +print(result) + + +#乘法运算 +def mul(a, b): + c = a*b + return c + +result=mul(2, 3) +print(result) + + +#除法运算 +def div(a, b): + c = a/b + return c + +result=div(8, 2) +print(result) + + +#取余运算 +def rem(a, b): + c = a%b + return c + +result=rem(7, 3) +print(result) + + +#开方运算 +def pre(a): + c = a**(1/2) + return c + +result=pre(9) +print(result) -- Gitee From 65b50196a968cd773563e203a04b675a6cb1cda6 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Wed, 23 Dec 2020 20:35:09 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...50\347\254\254\344\270\200\350\257\276.py" | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" index 44f74e8b..815c3c74 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\200\350\257\276.py" @@ -1,7 +1,7 @@ #加法运算 def add(a, b): - c = a+b + c = a + b return c result = add(2, 5) @@ -10,44 +10,44 @@ print(result) #减法运算 def sub(a, b): - c = a-b + c = a - b return c -result=sub(8, 5) +result = sub(8, 5) print(result) #乘法运算 def mul(a, b): - c = a*b + c = a * b return c -result=mul(2, 3) +result = mul(2, 3) print(result) #除法运算 def div(a, b): - c = a/b + c = a / b return c -result=div(8, 2) +result = div(8, 2) print(result) #取余运算 def rem(a, b): - c = a%b + c = a % b return c -result=rem(7, 3) +result = rem(7, 3) print(result) #开方运算 def pre(a): - c = a**(1/2) + c = a ** (1/2) return c -result=pre(9) +result = pre(9) print(result) -- Gitee From 76731aa7312692dff853595c2e1ba03a77d071fe Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Fri, 25 Dec 2020 22:01:49 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=BA=8C=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...50\347\254\254\344\272\214\350\257\276.py" | 82 +++++++++++++++++++ ...0\347\254\254\344\272\214\350\257\276.txt" | 78 ++++++++++++++++++ 2 files changed, 160 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.txt" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" new file mode 100644 index 00000000..2ed404cc --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" @@ -0,0 +1,82 @@ +output = open("第二周第二课.txt", "w", encoding="utf-8") +content = """ + +#字符串的编码和解码 +>>> a = "我爱python" +>>> a.encode("utf-8") +b'\xe6\x88\x91\xe7\x88\xb1python' +>>> b = a.encode("utf-8") +>>> b.decode("utf-8") +'我爱python' + + +#字符串的CRUD操作 +#1、创建(create) +>>> a = "hello" +>>> a = a + "world" +>>> a +'helloworld' + + +>>> a = "hello" +>>> a += "world" +>>> a +'helloworld' + + +#2、检索 +>>> a = "I love python" +>>> a[3] +'o' +>>> a.find("o") +3 + +>>> a = "12345.*****" +>>> a.startswith("12345") +True +>>> b = "*****_python" +>>> b.endswith("python") +True + +#3、更新(update) +>>> a = "I love pythen" +>>> a.replace("en", "on") +'I love python' + +>>> b = "apple, pear, banana, orange" +>>> b.split(",") +['apple', ' pear', ' banana', ' orange'] + +>>> c = b.split(",") +>>> ",".join(c) +'apple, pear, banana, orange' + +#4、删除 +>>> d = " I love python " +>>> d.strip() +'I love python' +>>> d.lstrip() +'I love python ' +>>> d.rstrip() +' I love python' + + +#字符串的格式化输出 +>>> a = "I" +>>> b = "love" +>>> c = "python" +>>> "{} {} {}".format(a, b, c) +'I love python' +>>> "{a} {b} {c}".format(a = "I", b = "love", c = "python") +'I love python' +>>> print(f"{a} {b} {c}") +I love python + +>>> a = 2.71828 +>>> "{:.3f}".format(a) +'2.718' + + +""" +output.write(content) +output.close() \ No newline at end of file diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.txt" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.txt" new file mode 100644 index 00000000..31ce5d9b --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.txt" @@ -0,0 +1,78 @@ + + +#字符串的编码和解码 +>>> a = "我爱python" +>>> a.encode("utf-8") +b'我爱python' +>>> b = a.encode("utf-8") +>>> b.decode("utf-8") +'我爱python' + + +#字符串的CRUD操作 +#1、创建(create) +>>> a = "hello" +>>> a = a + "world" +>>> a +'helloworld' + + +>>> a = "hello" +>>> a += "world" +>>> a +'helloworld' + + +#2、检索 +>>> a = "I love python" +>>> a[3] +'o' +>>> a.find("o") +3 + +>>> a = "12345.*****" +>>> a.startswith("12345") +True +>>> b = "*****_python" +>>> b.endswith("python") +True + +#3、更新(update) +>>> a = "I love pythen" +>>> a.replace("en", "on") +'I love python' + +>>> b = "apple, pear, banana, orange" +>>> b.split(",") +['apple', ' pear', ' banana', ' orange'] + +>>> c = b.split(",") +>>> ",".join(c) +'apple, pear, banana, orange' + +#4、删除 +>>> d = " I love python " +>>> d.strip() +'I love python' +>>> d.lstrip() +'I love python ' +>>> d.rstrip() +' I love python' + + +#字符串的格式化输出 +>>> a = "I" +>>> b = "love" +>>> c = "python" +>>> "{} {} {}".format(a, b, c) +'I love python' +>>> "{a} {b} {c}".format(a = "I", b = "love", c = "python") +'I love python' +>>> print(f"{a} {b} {c}") +I love python + +>>> a = 2.71828 +>>> "{:.3f}".format(a) +'2.718' + + -- Gitee From ef56e637f83afe75a7480c729f910115a5008350 Mon Sep 17 00:00:00 2001 From: wong <1513445111@qq.com> Date: Sun, 27 Dec 2020 22:13:15 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=91=A8=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...50\347\254\254\344\270\211\350\257\276.py" | 164 ++++++++++++++++++ ...0\347\254\254\344\270\211\350\257\276.txt" | 160 +++++++++++++++++ ...50\347\254\254\344\272\214\350\257\276.py" | 2 +- 3 files changed, 325 insertions(+), 1 deletion(-) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" new file mode 100644 index 00000000..4911b1e8 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.py" @@ -0,0 +1,164 @@ +output = open("第二周第三课.txt", "w", encoding="utf-8") +content = """ + + +#append(末尾添加元素) +>>> list_1 = ['a', 'b',] +>>> list_1.append('c') +>>> list_1 +['a', 'b', 'c'] + +#+和+= +>>> list_1 = ['a', 'b'] +>>> list_2 = ['c'] +>>> list_1 = list_1 + list_2 +>>> list_1 +['a', 'b', 'c'] + +>>> list_3 = ['ff'] +>>> list_1 += list_3 +>>> list_1 +['a', 'b', 'c', 'ff'] + +#*和*= +>>> list_1 = ['cc'] +>>> list_1 = list_1 * 10 +>>> list_1 +['cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc'] +>>> list_2 = ['dd'] +>>> list_2 *= 10 +>>> list_2 +['dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd'] + +#insert指定位置添加元素 +>>> list_1 = ['1', '2', '3'] +>>> list_.insert(1,'b') +>>> list_1 +['1', 'b', '2', '3'] + +#索引取值 +>>> list_1 = ['1', '2', '3'] +>>> list_1[2] +'3' + +#切片 +>>>list_1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] +>>> list_1[0:10:2] +[1, 3, 5, 7, 9] +>>> list_1[-1] +20 +>>> list_1.index(1) +0 + +#update +>>> list_1 = ['a', 'b', 'c', 'd', 'e', 'f'] +>>> list_1[1] = '00' +>>> list_1 +['a', '00', 'c', 'd', 'e', 'f'] +>>> list_1[1:3] = "45" +>>> list_1 +['a', '4', '5', 'd', 'e', 'f'] + +#delete +>>> list_1 = ['1', '2', '3'] +>>> list_1.pop() +'3' +>>> list_1.clear() +>>> list_1 +[] + +#排序 +>>> list_1 = [1, 2, 3, 4, 5] +>>> list_1 = [5, 6, 1, 9, 10] +>>> list_1.sort() +>>> list_1 +[1, 5, 6, 9, 10] + +list_2 = [5, 6, 1, 9, 10] +>>> sorted(list_2) +[1, 5, 6, 9, 10] + +>>> list_1 = [2, 6, 8, 4, 1] +>>> list_2 = [5, 9, 3, 7] +>>> list_1.reverse() +>>> list_1 +[1, 4, 8, 6, 2] + + +#tuple +>>> tuple_1 = ('a', 'b', 'c', 'd') +>>> tuple_1[0] +'a' +>>> tuple_1.index('c') +2 +>>> tuple_1[0:2] +('a', 'b') + + +#dict +>>> dict_1 = {'a': 1, 'b': 2, 'c': 3} +>>> dict_1['d'] = 4 +>>> dict_1 +{'a': 1, 'b': 2, 'c': 3, 'd': 4} +>>> dict_2 = {'e': 5} +>>> dict_1.update(dict_2) +>>> dict_1 +{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5} +>>> dict_1.setdefault('d', 8) +4 +>>> dict_1.setdefault('f', 6) +6 +>>> dict_1['b'] +2 +>>> dict_1.get('g', 7) +7 +>>> dict_1.keys() +dict_keys(['a', 'b', 'c', 'd', 'e', 'f']) +>>> dict_1.values() +dict_values([1, 2, 3, 4, 5, 6]) +>>> dict_1.items() +dict_items([('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5), ('f', 6)]) +>>> dict_1['b'] = 24 +>>> dict_1 +{'a': 1, 'b': 24, 'c': 3, 'd': 4, 'e': 5, 'f': 6} +>>> dict_1.update({'h': 10}) +>>> dict_1 +{'a': 1, 'b': 24, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'h': 10} +>>> dict_1.pop('c') +3 +>>> dict_1.popitem() +('h', 10) + + +#set +>>> set_1 = set([1, 2, 3]) +>>> set_1.add(4) +>>> set_1 +{1, 2, 3, 4} +>>> 2 in set_1 +True +>>> set_2 = set([5, 6]) +>>> set_1.update(set_2) +>>> set_1 +{1, 2, 3, 4, 5, 6} +>>> set_3 = set([7]) +>>> set_1.union(set_3) +{1, 2, 3, 4, 5, 6, 7} +>>> set_1.discard(3) +>>> set_1 +{1, 2, 4, 5, 6} +>>> set_1.remove(3) +Traceback (most recent call last): + File "", line 1, in +KeyError: 3 +>>> set_1.discard(3) +>>> + + + + + + +""" +output.write(content) +output.close() \ No newline at end of file diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" new file mode 100644 index 00000000..f88794c3 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\270\211\350\257\276.txt" @@ -0,0 +1,160 @@ + + + +#append(末尾添加元素) +>>> list_1 = ['a', 'b',] +>>> list_1.append('c') +>>> list_1 +['a', 'b', 'c'] + +#+和+= +>>> list_1 = ['a', 'b'] +>>> list_2 = ['c'] +>>> list_1 = list_1 + list_2 +>>> list_1 +['a', 'b', 'c'] + +>>> list_3 = ['ff'] +>>> list_1 += list_3 +>>> list_1 +['a', 'b', 'c', 'ff'] + +#*和*= +>>> list_1 = ['cc'] +>>> list_1 = list_1 * 10 +>>> list_1 +['cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc', 'cc'] +>>> list_2 = ['dd'] +>>> list_2 *= 10 +>>> list_2 +['dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd', 'dd'] + +#insert指定位置添加元素 +>>> list_1 = ['1', '2', '3'] +>>> list_.insert(1,'b') +>>> list_1 +['1', 'b', '2', '3'] + +#索引取值 +>>> list_1 = ['1', '2', '3'] +>>> list_1[2] +'3' + +#切片 +>>>list_1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] +>>> list_1[0:10:2] +[1, 3, 5, 7, 9] +>>> list_1[-1] +20 +>>> list_1.index(1) +0 + +#update +>>> list_1 = ['a', 'b', 'c', 'd', 'e', 'f'] +>>> list_1[1] = '00' +>>> list_1 +['a', '00', 'c', 'd', 'e', 'f'] +>>> list_1[1:3] = "45" +>>> list_1 +['a', '4', '5', 'd', 'e', 'f'] + +#delete +>>> list_1 = ['1', '2', '3'] +>>> list_1.pop() +'3' +>>> list_1.clear() +>>> list_1 +[] + +#排序 +>>> list_1 = [1, 2, 3, 4, 5] +>>> list_1 = [5, 6, 1, 9, 10] +>>> list_1.sort() +>>> list_1 +[1, 5, 6, 9, 10] + +list_2 = [5, 6, 1, 9, 10] +>>> sorted(list_2) +[1, 5, 6, 9, 10] + +>>> list_1 = [2, 6, 8, 4, 1] +>>> list_2 = [5, 9, 3, 7] +>>> list_1.reverse() +>>> list_1 +[1, 4, 8, 6, 2] + + +#tuple +>>> tuple_1 = ('a', 'b', 'c', 'd') +>>> tuple_1[0] +'a' +>>> tuple_1.index('c') +2 +>>> tuple_1[0:2] +('a', 'b') + + +#dict +>>> dict_1 = {'a': 1, 'b': 2, 'c': 3} +>>> dict_1['d'] = 4 +>>> dict_1 +{'a': 1, 'b': 2, 'c': 3, 'd': 4} +>>> dict_2 = {'e': 5} +>>> dict_1.update(dict_2) +>>> dict_1 +{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5} +>>> dict_1.setdefault('d', 8) +4 +>>> dict_1.setdefault('f', 6) +6 +>>> dict_1['b'] +2 +>>> dict_1.get('g', 7) +7 +>>> dict_1.keys() +dict_keys(['a', 'b', 'c', 'd', 'e', 'f']) +>>> dict_1.values() +dict_values([1, 2, 3, 4, 5, 6]) +>>> dict_1.items() +dict_items([('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5), ('f', 6)]) +>>> dict_1['b'] = 24 +>>> dict_1 +{'a': 1, 'b': 24, 'c': 3, 'd': 4, 'e': 5, 'f': 6} +>>> dict_1.update({'h': 10}) +>>> dict_1 +{'a': 1, 'b': 24, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'h': 10} +>>> dict_1.pop('c') +3 +>>> dict_1.popitem() +('h', 10) + + +#set +>>> set_1 = set([1, 2, 3]) +>>> set_1.add(4) +>>> set_1 +{1, 2, 3, 4} +>>> 2 in set_1 +True +>>> set_2 = set([5, 6]) +>>> set_1.update(set_2) +>>> set_1 +{1, 2, 3, 4, 5, 6} +>>> set_3 = set([7]) +>>> set_1.union(set_3) +{1, 2, 3, 4, 5, 6, 7} +>>> set_1.discard(3) +>>> set_1 +{1, 2, 4, 5, 6} +>>> set_1.remove(3) +Traceback (most recent call last): + File "", line 1, in +KeyError: 3 +>>> set_1.discard(3) +>>> + + + + + + diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" index 2ed404cc..d23ff26d 100644 --- "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/2\347\217\255/2\347\217\255_Wong/\347\254\254\344\272\214\345\221\250\347\254\254\344\272\214\350\257\276.py" @@ -79,4 +79,4 @@ I love python """ output.write(content) -output.close() \ No newline at end of file +output.close() -- Gitee