会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
洗洗睡吧
自闭。。。。。。
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
4
5
6
7
8
9
10
11
12
···
51
下一页
2023年10月22日
django从配置文件中读取数据库信息
摘要: 创建配置文件my.cnf [client] database=django_db user=root password=123456 host=127.0.0.1 port=3306 settings.py DATABASES = { 'default': { 'ENGINE': 'django.d
阅读全文
posted @ 2023-10-22 16:52 我在路上回头看
阅读(88)
评论(0)
推荐(0)
2023年10月4日
openssl创建证书
摘要: 安装 brew install openssl 使用 root@MACdeMBP rem_key # openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 Generating a 4096 bit RS
阅读全文
posted @ 2023-10-04 13:18 我在路上回头看
阅读(106)
评论(0)
推荐(0)
2023年8月30日
__init_subclass__特殊方法
摘要: ```python __init_subclass__ 是 Python 3.6 引入的一个特殊方法,用于在子类被定义时执行一些操作。 这个方法允许你在父类中定义一个类方法,当子类继承父类时会自动调用这个方法,你可以在其中进行一些初始化工作。 以下是关于 __init_subclass__ 方法的一
阅读全文
posted @ 2023-08-30 10:38 我在路上回头看
阅读(55)
评论(0)
推荐(0)
特性工厂函数
摘要: ```python def quantity(storage_name): def qty_getter(instance): return instance.__dict__[storage_name] def qty_setter(instance,value): if value > 0: i
阅读全文
posted @ 2023-08-30 08:48 我在路上回头看
阅读(18)
评论(0)
推荐(0)
2023年8月29日
泛型协变和逆变
摘要: ```python from typing import TypeVar, Generic class Beverage: ❶ """任何饮料""" class Juice(Beverage): """任何果汁""" class OrangeJuice(Juice): """使用巴西橙子制作的美味果
阅读全文
posted @ 2023-08-29 15:35 我在路上回头看
阅读(117)
评论(0)
推荐(0)
泛型类Generic注解
摘要: 在 Python 的 typing 模块中,Generic 是一个泛型类,用于创建参数化的类和函数,以便支持不同类型的参数。它允许你定义具有类型参数的类,这些类型参数在实例化时才确定。这样,你可以在不同的上下文中使用相同的类,但可以使用不同的类型参数。 使用 Generic 可以增强代码的可重用性和
阅读全文
posted @ 2023-08-29 14:56 我在路上回头看
阅读(919)
评论(0)
推荐(0)
2023年8月28日
pycharm中自定义函数补全
摘要: ```python 在 PyCharm 中,你可以通过以下步骤实现这一目标: 打开 PyCharm,点击顶部菜单的 "File"(文件) -> "Settings"(设置)。 在弹出的窗口中,选择 "Editor"(编辑器) -> "Live Templates"(代码模板)。 在左侧的列表中,选择
阅读全文
posted @ 2023-08-28 12:10 我在路上回头看
阅读(426)
评论(0)
推荐(0)
类型注解Callable
摘要: from collections.abc import Callable """ Callable[[ParamType1, ParamType2], ReturnType] [参数1类型,参数2类型], 返回值类型 Callable[[], int] 是 Callable[[], float] 的
阅读全文
posted @ 2023-08-28 11:05 我在路上回头看
阅读(74)
评论(0)
推荐(0)
类型别名TypeAlias
摘要: ```python from collections.abc import Iterable from typing import TypeAlias FromTo = tuple[str, str] # 3.10之前 FromTo: TypeAlias = tuple[str, str] # 3.
阅读全文
posted @ 2023-08-28 08:44 我在路上回头看
阅读(33)
评论(0)
推荐(0)
2023年8月18日
pika
摘要: # 生产者代码 ```python # -*- coding: utf-8 -*- # pylint: disable=C0111,C0103,R0205 import json import pika from pika.exchange_type import ExchangeType prin
阅读全文
posted @ 2023-08-18 02:00 我在路上回头看
阅读(85)
评论(0)
推荐(0)
上一页
1
···
4
5
6
7
8
9
10
11
12
···
51
下一页
公告