CV肉饼王

Talk is cheap. Show me the code.

0%

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# build stage
FROM python:3.10-slim

# copy files
COPY pyproject.toml pdm.lock /project/
WORKDIR /project

# install PDM
RUN pip install -U pip setuptools wheel
RUN pip install pdm

# install dependencies
RUN pdm install
COPY . .

# Install Doppler CLI
RUN apt-get update && apt-get install -y apt-transport-https ca-certificates curl gnupg && \
curl -sLf --retry 3 --tlsv1.2 --proto "=https" 'https://packages.doppler.com/public/cli/gpg.DE2A7741A397C129.key' | apt-key add - && \
echo "deb https://packages.doppler.com/public/cli/deb/debian any-version main" | tee /etc/apt/sources.list.d/doppler-cli.list && \
apt-get update && \
apt-get -y install doppler
ARG DOPPLER_TOKEN
ENV DOPPLER_TOKEN=$DOPPLER_TOKEN
EXPOSE 8000
CMD ["pdm", "run", "start"]
阅读全文 »

一、*符号

1.解包所有可迭代对象,比如list、tuple、string

1
2
3
4
num_list = [1, 2, 3, 4, 5]
num_list_2 = [6, 7, 8, 9, 10]
new_list = [*num_list, *num_list_2]
print(new_list) # [1,2,3,4,5,6,7,8,9,10]
阅读全文 »

1.参数的默认值

1
2
3
def search4letters(phrase: str, letters: str = 'aeiou') -> set:
"""在指定字符串中找到输入的字母"""
return set(letters) & set(phrase)
阅读全文 »

一、语法

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}摄氏度')
阅读全文 »