From 6c6b2f375126c870ff7e1f68d41f9c31380bb72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?4=E7=8F=AD=20=7C=20=E5=91=A8=E5=B2=B1?= Date: Wed, 30 Dec 2020 18:53:16 +0800 Subject: [PATCH 1/4] =?UTF-8?q?4=E7=8F=AD=5F=E5=91=A8=E5=B2=B1=5F=E7=AC=AC?= =?UTF-8?q?2=E5=91=A8=5F=E7=AC=AC2=E8=8A=82=E8=AF=BE=E4=BD=9C=E4=B8=9A=204?= =?UTF-8?q?=E7=8F=AD=5F=E5=91=A8=E5=B2=B1=5F=E7=AC=AC2=E5=91=A8=5F?= =?UTF-8?q?=E7=AC=AC2=E8=8A=82=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0302.py" | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/4\347\217\255/4\347\217\255_\345\221\250\345\262\261/0302.py" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/4\347\217\255/4\347\217\255_\345\221\250\345\262\261/0302.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/4\347\217\255/4\347\217\255_\345\221\250\345\262\261/0302.py" new file mode 100644 index 00000000..d2cc2dc9 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/4\347\217\255/4\347\217\255_\345\221\250\345\262\261/0302.py" @@ -0,0 +1,46 @@ +print("周岱".encode("utf-8")) + +print(b'\xe5\x91\xa8\xe5\xb2\xb1'.decode("utf-8")) + +a = "hello " +b = "world" +print(a + b) + +a += b +print(a) + +a = "hello world" +print(a[2]) +print(a.find("h")) +print(a.index("w")) + +a = "202012011" +b = "202012021" +c = "202012031" +d = a + b + c +print(d.startswith("2020")) +print(d.endswith("1")) + +a = "Now Year" +print(a.replace("Now","New")) + +a = "11,22,33" +print(a.split(",")) + +a = ['11','22','33'] +print(",".join(a)) + +a = " New Year " +print(a.strip()) + +a = " New Year 2021" +print(a.lstrip()) + +a = " New Year 2021 " +print(a.rstrip()) + +a = "ba" +b = "la" +print(f"speak:{a},{b},{a},{b}") + +print("{:.4f}".format(3.1415926)) -- Gitee From 3b93840bae8500b8a7abe1ba98e6da2662edc46a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?4=E7=8F=AD=20=7C=20=E5=91=A8=E5=B2=B1?= Date: Wed, 30 Dec 2020 18:56:21 +0800 Subject: [PATCH 2/4] =?UTF-8?q?4=E7=8F=AD=5F=E5=91=A8=E5=B2=B1=5F=E7=AC=AC?= =?UTF-8?q?2=E5=91=A8=5F=E7=AC=AC3=E8=8A=82=E8=AF=BE=E4=BD=9C=E4=B8=9A=204?= =?UTF-8?q?=E7=8F=AD=5F=E5=91=A8=E5=B2=B1=5F=E7=AC=AC2=E5=91=A8=5F?= =?UTF-8?q?=E7=AC=AC3=E8=8A=82=E8=AF=BE=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0303.py" | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 "\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/4\347\217\255/4\347\217\255_\345\221\250\345\262\261/0303.py" diff --git "a/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/4\347\217\255/4\347\217\255_\345\221\250\345\262\261/0303.py" "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/4\347\217\255/4\347\217\255_\345\221\250\345\262\261/0303.py" new file mode 100644 index 00000000..83f79697 --- /dev/null +++ "b/\347\254\254\344\272\214\346\234\237\350\256\255\347\273\203\350\220\245/4\347\217\255/4\347\217\255_\345\221\250\345\262\261/0303.py" @@ -0,0 +1,142 @@ +# list增加 +a1 = [1, 2] +a1.append(3) +print(a1) + +a2 = [1, 2] +a3 = [3, 4] +a2 += a3 +print(a2) + +a3 = "bala " +print(a3 * 10) + +a4 = [1, 3] +a4.insert(1, 2) +print(a4) + + +# list检索 +b1 = [1, 2, 3, 4, 5, 6, 7] +print(b1[0:2]) +print(b1[1:7:2]) + + +# list更新 +c1 = [1, 2, 3, 4, 5, 6, 7] +c1[1] = 1.1 +print(c1) + +c2 = [1, 2, 3, 4, 5, 6, 7] +c2[0:2] = (1,) +print(c2) + + +# list删除 +d1 = [1, 2, 3, 4, 5, 6, 7] +d2 = d1.pop() +print(d1) +print(d2) + +d1.clear() +print(d1) + + +# list排序 +e1 = [3, 1, 7, 9, 5] +e1.sort() +print(e1) + +e2 = [3, 1, 7, 9, 5] +e3 = sorted(e2) +print(e3) + +e4 = [3, 1, 7, 9, 5] +e4.reverse() +print(e4) + +e5 = [3, 1, 7, 9, 5] +e6 = list(reversed(e5)) +print(e6) + + +# dict增加 +f1 = {"one": 1, "two": 2} +f2 = {"three":3} +f1.update(f2) +print(f1) + +f3 = {"one": 1, "two": 2, "three": 3} +f4 = f3.setdefault("two", 4) +print(f4) + +f5 = {"one": 1, "two": 2, "three": 3} +f5.setdefault("four", 4) +print(f5) + + +# dict检索 +j1 = {"one": 1, "two": 2, "three": 3, "four": 4} +j2 = j1.get("four") +print(j2) +j3 = j1.get("five") +print(j3) +print(j1["two"]) + +j5 = j1.values() +print(j5) +j6 = j1.items() +print(j6) + + +# dict更新 +h1 = {"one": 1, "two": 2, "three": 3, "four": 4} +h1["one"] = "one" +print(h1) + +h1.update({"two": "two", "three": "three", "four": "four"},) +print(h1) + + +# dict删除 +i1 = {"one": "1", "two": 2, "three": 3, "four": 4} +i1.pop("four") +print(i1) + +i1 = {"one": "1", "two": 2, "three": 3} +i2 = i1.popitem() +print(i1) +print(i2) + + +# set增加 +l1 = {1, 2} +l1.add(3) +print(l1) + + +# set检索 +m1 = {"one", "two"} +print("one" in m1) + + +# set更新 +n1 = {1, 2} +n1.update({3}) +print(n1) + +n2 = {1, 2} +n3 = {3, 4} +n4 = n2.union(n3) +print(n4) + + +# set删除 +o1 = {'one', 'two', 'three'} +o2 = o1.pop() +print(o1) +print(o2) + +o3 = {'one', 'two', 'three'} +o3.remove("one") +print(o3) -- Gitee From fa005819a7b5d7578a9f74cde7a53d8c190b3925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?4=E7=8F=AD=20=7C=20=E5=91=A8=E5=B2=B1?= Date: Wed, 30 Dec 2020 19:01:33 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=200303?= =?UTF-8?q?.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0303.py | 142 -------------------------------------------------------- 1 file changed, 142 deletions(-) delete mode 100644 0303.py diff --git a/0303.py b/0303.py deleted file mode 100644 index 83f79697..00000000 --- a/0303.py +++ /dev/null @@ -1,142 +0,0 @@ -# list增加 -a1 = [1, 2] -a1.append(3) -print(a1) - -a2 = [1, 2] -a3 = [3, 4] -a2 += a3 -print(a2) - -a3 = "bala " -print(a3 * 10) - -a4 = [1, 3] -a4.insert(1, 2) -print(a4) - - -# list检索 -b1 = [1, 2, 3, 4, 5, 6, 7] -print(b1[0:2]) -print(b1[1:7:2]) - - -# list更新 -c1 = [1, 2, 3, 4, 5, 6, 7] -c1[1] = 1.1 -print(c1) - -c2 = [1, 2, 3, 4, 5, 6, 7] -c2[0:2] = (1,) -print(c2) - - -# list删除 -d1 = [1, 2, 3, 4, 5, 6, 7] -d2 = d1.pop() -print(d1) -print(d2) - -d1.clear() -print(d1) - - -# list排序 -e1 = [3, 1, 7, 9, 5] -e1.sort() -print(e1) - -e2 = [3, 1, 7, 9, 5] -e3 = sorted(e2) -print(e3) - -e4 = [3, 1, 7, 9, 5] -e4.reverse() -print(e4) - -e5 = [3, 1, 7, 9, 5] -e6 = list(reversed(e5)) -print(e6) - - -# dict增加 -f1 = {"one": 1, "two": 2} -f2 = {"three":3} -f1.update(f2) -print(f1) - -f3 = {"one": 1, "two": 2, "three": 3} -f4 = f3.setdefault("two", 4) -print(f4) - -f5 = {"one": 1, "two": 2, "three": 3} -f5.setdefault("four", 4) -print(f5) - - -# dict检索 -j1 = {"one": 1, "two": 2, "three": 3, "four": 4} -j2 = j1.get("four") -print(j2) -j3 = j1.get("five") -print(j3) -print(j1["two"]) - -j5 = j1.values() -print(j5) -j6 = j1.items() -print(j6) - - -# dict更新 -h1 = {"one": 1, "two": 2, "three": 3, "four": 4} -h1["one"] = "one" -print(h1) - -h1.update({"two": "two", "three": "three", "four": "four"},) -print(h1) - - -# dict删除 -i1 = {"one": "1", "two": 2, "three": 3, "four": 4} -i1.pop("four") -print(i1) - -i1 = {"one": "1", "two": 2, "three": 3} -i2 = i1.popitem() -print(i1) -print(i2) - - -# set增加 -l1 = {1, 2} -l1.add(3) -print(l1) - - -# set检索 -m1 = {"one", "two"} -print("one" in m1) - - -# set更新 -n1 = {1, 2} -n1.update({3}) -print(n1) - -n2 = {1, 2} -n3 = {3, 4} -n4 = n2.union(n3) -print(n4) - - -# set删除 -o1 = {'one', 'two', 'three'} -o2 = o1.pop() -print(o1) -print(o2) - -o3 = {'one', 'two', 'three'} -o3.remove("one") -print(o3) -- Gitee From c760d1157e4f0d5be3ebda8487044039f3ffd031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?4=E7=8F=AD=20=7C=20=E5=91=A8=E5=B2=B1?= Date: Wed, 30 Dec 2020 19:01:40 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=200302?= =?UTF-8?q?.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0302.py | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 0302.py diff --git a/0302.py b/0302.py deleted file mode 100644 index d2cc2dc9..00000000 --- a/0302.py +++ /dev/null @@ -1,46 +0,0 @@ -print("周岱".encode("utf-8")) - -print(b'\xe5\x91\xa8\xe5\xb2\xb1'.decode("utf-8")) - -a = "hello " -b = "world" -print(a + b) - -a += b -print(a) - -a = "hello world" -print(a[2]) -print(a.find("h")) -print(a.index("w")) - -a = "202012011" -b = "202012021" -c = "202012031" -d = a + b + c -print(d.startswith("2020")) -print(d.endswith("1")) - -a = "Now Year" -print(a.replace("Now","New")) - -a = "11,22,33" -print(a.split(",")) - -a = ['11','22','33'] -print(",".join(a)) - -a = " New Year " -print(a.strip()) - -a = " New Year 2021" -print(a.lstrip()) - -a = " New Year 2021 " -print(a.rstrip()) - -a = "ba" -b = "la" -print(f"speak:{a},{b},{a},{b}") - -print("{:.4f}".format(3.1415926)) -- Gitee