摘要: 原文:https://docs.quantifiedcode.com/python-anti-patterns/performance/using_key_in_list_to_check_if_key_is_contained_in_a_list.html 使用 key in list 去迭代li 阅读全文
posted @ 2018-05-31 21:18 YYRise 阅读(5467) 评论(0) 推荐(0) 编辑
摘要: 原理参考论文 代码已提交到git(https://github.com/YYRise/find_path/blob/master/jps.py) 阅读全文
posted @ 2018-05-31 20:52 YYRise 阅读(1784) 评论(0) 推荐(0) 编辑
摘要: list中有n个值,赋值给k个变量:a1, a2, ……,ak 从下标i开始的k个元素赋给a1, a2, ..., ak: a1, a2, ..., ak = list[i : i+k] #默认i = 0, k = len(List) 阅读全文
posted @ 2018-05-28 19:41 YYRise 阅读(1820) 评论(0) 推荐(0) 编辑
摘要: “is” is the identity comparison. #比较引用是否相同 “==” is the equality comparison. #比较内容是否相同 阅读全文
posted @ 2018-05-28 14:49 YYRise 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 参数前“-”的表明后面的参数是字符形式。 参数前“--”的则表明后面的参数是单词形式。 参数前有横的是System V风格。 参数前没有横的是BSD风格。 阅读全文
posted @ 2018-05-25 20:03 YYRise 阅读(439) 评论(0) 推荐(0) 编辑
摘要: 1、 -A 显示匹配行和之后的几行。-B是显示匹配行和它前面的n行。-C是匹配行和它前后各n行 -A NUM, --after-context=NUM -B NUM, --before-context=NUM -C NUM, -NUM, --context=NUM 2、-n :输出行号。 阅读全文
posted @ 2018-05-25 16:48 YYRise 阅读(79) 评论(0) 推荐(0) 编辑
摘要: unicode是字符集, 为每一个「字符」分配一个唯一的 ID;Unicode编码通常是2个字节,占用存储空间。全部是英文的话,用Unicode编码比ASCII编码需要多一倍的存储空间 utf-8是编码规则,把一个Unicode字符根据不同的数字大小编码成1-6个字节,常用的英文字母被编码成1个字节 阅读全文
posted @ 2018-05-14 19:54 YYRise 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 一、只有一个goroutine时,读写阻塞的chan会出错(“fatal error: all goroutines are asleep - deadlock!”)。包括未make的chan(chan = nil) 二、已经close的chan,写操作会panic(“panic: send on 阅读全文
posted @ 2018-04-01 16:58 YYRise 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 1、Array:在内存中连续存储。索引速度快。赋值,修改元素简单。 不足:(1)插入数据麻烦 (2)声明时必须指定长度 2、ArrayList:解决了Array的不足 不足:(1)类型不安全 (2)存储或检索值类型时有装箱、拆箱操作,性能消耗 3、List: 与ArrayList类似,弥补了Arra 阅读全文
posted @ 2018-02-06 21:25 YYRise 阅读(1408) 评论(0) 推荐(0) 编辑
摘要: git fetch origin git reset --hard origin/<branch> 阅读全文
posted @ 2018-02-06 10:29 YYRise 阅读(5759) 评论(0) 推荐(0) 编辑