- 博客(7)
- 收藏
- 关注
原创 Ways to remove duplicates from a given list
Python ways of getting a list of unique elements from a list that possibly contains duplicatesWe may use a wide range of approaches to solve this problem, common ways incl.:set (when seq order is n...
2019-10-13 16:37:13
174
原创 Monkey Patching and adding method dynamically
Monkey PatchingSummaryThe conceptMonkey patching is a technique that is adopted to dynamically update the behavior of a piece of code at runtimeWhy use it?It allows us to modify or extend the beh...
2019-10-07 20:01:59
243
原创 国王和金矿 python解法
国王和金矿 python解法Solutiondef get_most_gold(n, w): _vals, vals = [0]*w, [0]*w for i in range(w): if i + 1 < cap[0]: _vals[i] = 0 else: _vals[i] = vol[0] # -> ord of gold...
2019-10-05 06:03:31
494
原创 计算两个单链表所代表的的数的和
如何计算两个单链表所代表的数的和?采取链表相加法,解决了一个潜在的问题:当链表所代表的数字很大的时候(超出了long的表示范围),简单的将链表所代表的数相加就无法进行from LinkedList import Node, LinkedListdef swap_lists(ll1, ll2): summing_list, summed_list = LinkedList(), Lin...
2019-10-05 06:03:06
143
原创 Python Collections
namedtupleSummarycollections.namedtuple(typename, field_names, *, rename=False,defaults=None, module=None)Returns a new tuple subclass named typename. The new subclass is used to create tuple-like ...
2019-10-05 06:02:50
107
原创 Python zip(), map(), filter(), reduce()
zip()Summaryzip() makes an iterator that aggregates elements from each of the iterables.zip() returns an iterator of tuples, where the i-th tuple contains the i-th element from each of the iterable...
2019-10-03 17:59:09
222
原创 解决WSL更改默认字体为consolas,进入文件后退出文件字体又变为宋体
解决WSL更改默认字体为consolas,进入文件后退出文件字体又变为宋体解决方法如下输入regedit进入注册表编辑器HKEY_CURRENT_USER\Console\C:Program Files_WindowsApps_CanonicalGroupLimited.UbuntuonWindows1804.2019.521.0_x64__79rhkp1fndgsc_ubuntu.exe...
2019-10-03 00:39:51
1703
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅