Loading

上一页 1 2 3 4 5 6 ··· 8 下一页
摘要: 基本使用 # 安装 pip install numpy # 更新 pip install -U numpy # 卸载 pip uninstall numpy 指定源安装 安装时指定: # 清华源 pip install numpy -i https://pypi.tuna.tsinghua.edu. 阅读全文
posted @ 2024-07-03 12:35 kingron 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 方法 使用如下命令可打印当前 python 所使用的三方包路径: python -m site 或: python -c 'import site; print(site.getsitepackages())' 参考 site Site-specific configuration hook — P 阅读全文
posted @ 2024-07-03 12:25 kingron 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 时间复杂度与空间复杂度 常用O(1)或O(n)表示,其中1表示一个单位(最简单的单位,可以是多个或1个,但在时间上总体是较低且连续的),时间通常指的是程序运行时间,空间则是指程序在运行时所占用的内存空间。各个阶段的复杂度可用下面的顺序比较: O(1) < O(logn) < O(n) < O(nlo 阅读全文
posted @ 2024-07-03 12:13 kingron 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1. 子查询用 count 作为返回值 期望的 SQL 类似于: select (select count(*) from child where child.pid = parent.id) as auth_exists from parent 写法: subquery = Subquery(Ch 阅读全文
posted @ 2024-06-28 23:35 kingron 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 介绍 mockito 是一个 pytest 插件,相比于 unitest.mock,具有如下特点: 所有对象都自动为 autospec,无需担心模拟对象被错误的调用而不被发现 不使用字符串参数作为模拟对象,可以减少拼写错误 提供的返回值或抛出错误更加冗长,但也更明确和具体 安装 使用 pip 安装即 阅读全文
posted @ 2024-06-26 09:50 kingron 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 问题 想要在 orm 中定义外键,便于关联查询,但不想在数据库中生成实际的外键约束。 解决方式 Django 的 ForeignKey 和数据库的 FOREIGN KEY 并不一样。Django 的 ForeignKey 是一种逻辑上的两个表的关联关系,可以指定是否使用数据库的 FOREIGN KE 阅读全文
posted @ 2024-06-25 22:36 kingron 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 代码如下: from django.db import connections with connections['db_to_create_a_table_in'].schema_editor() as schema_editor: schema_editor.create_model(YourU 阅读全文
posted @ 2024-06-25 22:28 kingron 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1. Django 的 QuerySet 是惰性的 Django 的 QuerySet 对应于数据库的若干记录(row),通过可选的查询来过滤。例如,下面的代码会得到数据库中名字为 Dave 的所有的人: person_set = Person.objects.filter(first_name=" 阅读全文
posted @ 2024-06-25 22:26 kingron 阅读(7) 评论(0) 推荐(0) 编辑
摘要: How to enlarge the maximum size of the message delivered to Kafka? From: Frequently Asked Questions For large transactions it is possible that Kafka C 阅读全文
posted @ 2024-06-25 16:41 kingron 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 撤销 rebase 查看本地记录: git reflog 在 reflog 中找到本次 rebase 之前的 id 回退到对应的 id git reset --hard <第2步拿到的id> 如果此时仍处于 rebase 状态,使用命令取消: git rebase --abort 合并时处理发生变更 阅读全文
posted @ 2024-06-24 13:03 kingron 阅读(9) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 8 下一页