该文被密码保护。 阅读全文
posted @ 2023-02-17 14:44 Zinc233 阅读(1) 评论(0) 推荐(0) 编辑
摘要: # Dart > 基于B站视频 [Dart](https://www.bilibili.com/video/BV1rN411Z7JH) 学习 ## 基础 ### 注释 ```dart // 单行注释 /* 多行注释 */ /// 文档注释(支持markdown) ``` ### 变量 万物皆对象,变 阅读全文
posted @ 2023-01-13 17:23 Zinc233 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 上下文管理器和else快 类似于 then 的 else for...else... 仅在 for 循环运行完毕后运行 else, 不能被 break while...else... 仅在 while 条件为 false 而退出后运行 else, 不能被 break try...else... 仅在 阅读全文
posted @ 2022-12-03 21:20 Zinc233 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 可迭代的对象、迭代器和生成器 import re import reprlib RE_WORD = re.compile('\w+') class Sentence_v1: def __init__(self, text): self.text = text self.words = RE_WORD 阅读全文
posted @ 2022-12-03 21:19 Zinc233 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 协程 用作协程的生成器的基本行为 协程使用生成器函数定义: 定义体中有 yield 关键字 def simple_coroutine(): print('-> coroutine start') x = yield # 因为 yield 右边没有值, 所以产出 None print('-> coro 阅读全文
posted @ 2022-12-03 21:19 Zinc233 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 正确重载运算符 一元运算符 - (__neg__) + (__pos__) 最好返回 self 的副本 ~ (__invert__) 对整数位按位取反 (~x == -(x+1)) print(~2) -3 中辍运算符 + from array import array from itertools 阅读全文
posted @ 2022-12-03 21:13 Zinc233 阅读(11) 评论(0) 推荐(0) 编辑
摘要: S11 接口:从协议到抽象基类 # random.shuffle 就地打乱 from random import shuffle l = list(range(10)) shuffle(l) print(l) shuffle(l) print(l) [0, 6, 3, 2, 4, 8, 5, 7, 阅读全文
posted @ 2022-12-03 21:10 Zinc233 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 序列的修改、散列和切片 from array import array import reprlib, math, numbers from functools import reduce from operator import xor from itertools import chain # 阅读全文
posted @ 2022-12-03 11:29 Zinc233 阅读(73) 评论(0) 推荐(0) 编辑