肉饼博客

Talk is cheap. Show me the code.

0%

一、语法

1
lambda argument_list:expersion

注意1:lambda函数体只能写一句话

注意2:不支持赋值语句,如下代码报错

1
func01 = lambda p: p = 10
阅读全文 »

文/雨令

有的人在十年前买了好几套房,结果成了千万富翁,有的人在前几年进了股市,结果却一贫如洗。

有的人顺风顺水步步高升一路躺赢,也有的人忙忙碌碌东奔西走依然举步维艰。

每个人一路走来,都在做着这样或那样的选择,你选择上学,他选择出国,你选择上班,他选择创业,那些看似不经意的选择,总是会在往后很长的一段时间里左右着我们的命运起伏。

阅读全文 »

今天是大年初一,虽然一个多礼拜没洗澡了,但身上的水痘好多了,趁着有大块的空闲时间,来写写年终总结。

阅读全文 »

Some differences from dict still remain:

  • The regular dict was designed to be very good at mapping operations. Tracking insertion order was secondary.
  • The OrderedDict was designed to be good at reordering operations. Space efficiency, iteration speed, and the performance of update operations were secondary.
  • The OrderedDict algorithm can handle frequent reordering operations better than dict. As shown in the recipes below, this makes it suitable for implementing various kinds of LRU caches.
  • The equality operation for OrderedDict checks for matching order.
    阅读全文 »

一.Counter计数

1.查询某元素出现次数、查询出现此次最多的n个元素

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from collections import Counter

temp = Counter('abcdeabcdabcaba')
print(temp.items()) # dict_items([('a', 5), ('b', 4), ('c', 3), ('d', 2), ('e', 1)])

for item in temp.items():
print(item)
"""
('a', 5)
('b', 4)
('c', 3)
('d', 2)
('e', 1)
"""

print(temp.most_common(1)) # 统计出现次数最多的一个元素,[('a', 5)]
print(temp.most_common(2)) # 统计出现次数最多个两个元素,[('a', 5), ('b', 4)]

print(temp['a']) # 查询单个元素出现次数,5
temp['a'] += 1 # 增加单个元素出现次数,6
temp['a'] -= 1 # 增加单个元素出现次数,5
del temp['a'] # 删除,({'b': 4, 'c': 3, 'd': 2, 'e': 1})
阅读全文 »

1.数据类型

整型int、浮点数float、字符串str、布尔bool(True、False)

2.print格式化输出

1
2
3
4
5
6
name = input('please enter your name: ')
print('hello,', name)

print('%.1f华氏度 = %.1f摄氏度' % (f, c))
# 或者
print(f'{f:.1f}华氏度 = {c:.1f}摄氏度')
阅读全文 »

姗姗来迟的年终总结,因为年末的跳槽,因为自己的懒惰,因为各种琐事,没有一个合适的时机静下心来和自己对话,所以一直拖到现在

想想2021年,似乎除了年末的换工作,并没有什么谈得上的大事,生活真的就像似水流年一样,不经意间就过去了,只能又去微信和豆瓣上翻翻,才恍然大悟”哦,原来是那个时候的事请哦”

阅读全文 »

1.下载安装nvm
1
2
3
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
或者
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
2.在.zshrc中配置环境变量
1
2
3
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
阅读全文 »

1.TypeError [ERR_INVALID_ARG_TYPE]: The “mode” argument must be integer. Received an instance of Object

解决:hexo 不支持最新 node14+,降低node版本到12

[email protected]: Permission denied (publickey).fatal: Could not read from remote repository.

解决:将.ssh目录下的id_rsa.pub加到Github ssh key中

命令:将公钥复制到剪贴板:pbcopy < ~/.ssh/id_rsa.pub

阅读全文 »

一、不含z-index的堆叠规则

1.有设置了position属性的兄弟元素,不管他们的position值为何,都按照它们在HTML结构中出现的顺序堆叠

2.没有设置position属性的元素,始终在定位元素的下层,即便他们在HTML结构中位于较晚的位置

阅读全文 »