update(post)
This commit is contained in:
parent
e378f8960a
commit
28f343ae37
@ -1,7 +1,9 @@
|
||||
## 安装
|
||||
|
||||
skip
|
||||
|
||||
## 添加模块
|
||||
```
|
||||
|
||||
```shell
|
||||
npx shadcn@latest add [moudle_name]
|
||||
```
|
||||
|
@ -0,0 +1,31 @@
|
||||
## 生成 SSH 密钥和公钥
|
||||
|
||||
```shell
|
||||
ssh-keygen -t ed25519 -C "YOUR-EMAIL"
|
||||
```
|
||||
|
||||
然后一路回车
|
||||
在 `~/.ssh` 下:
|
||||
公钥: `id_ed25519.pub`
|
||||
私钥: `id_ed25519`
|
||||
|
||||
## Git 设置远程使用指定端口的SSH连接
|
||||
|
||||
1. 在 `~/.ssh` 下创建 `config` 文件
|
||||
2. 添加以下内容:
|
||||
|
||||
```config
|
||||
Host <远程主机名或IP>
|
||||
Port <指定的SSH端口>
|
||||
```
|
||||
|
||||
其中,<远程主机名或IP>是你要连接的远程仓库的主机名或IP地址,<指定的SSH端口>是你要使用的SSH端口号
|
||||
3. 在Git仓库中使用指定端口的SSH连接(*注意**不要使用**参考链接文章中的连接方式,那是错误的*)
|
||||
|
||||
```shell
|
||||
git remote set-url origin ssh://example.com:username/repo.git
|
||||
```
|
||||
|
||||
## 参考
|
||||
|
||||
[Git 设置远程使用指定端口的SSH连接](https://geek-docs.com/git/git-questions/608_git_setting_remote_to_use_specified_port_for_ssh.html)
|
21
docs/src/69_Python/6_变量的作用域.md
Normal file
21
docs/src/69_Python/6_变量的作用域.md
Normal file
@ -0,0 +1,21 @@
|
||||
一段示例代码(这段代码是错误的):
|
||||
|
||||
```python
|
||||
num = 100
|
||||
|
||||
def d1():
|
||||
num += 1
|
||||
print(num)
|
||||
|
||||
d1()
|
||||
print(num)
|
||||
```
|
||||
|
||||
执行它会报错`UnboundLocalError`,这是因为 `d1` 中对变量 `num` 进行了赋值操作,这使得 Python 将 `num` 视为局部变量。然而,在进行赋值之前,尝试对 `num` 进行自增操作,此时 `num` 尚未被赋值
|
||||
|
||||
所以需要使用 `global` 关键字来告诉 Python `num` 是一个全局变量,因此 `num += 1` 操作会修改全局变量 `num` 而不是创建一个新的局部变量
|
||||
|
||||
**Python 的作用域规则如下:**
|
||||
|
||||
* 如果在函数内部对一个变量进行赋值操作(例如 num += 1 或 num = 101),Python 会认为这个变量是一个局部变量。
|
||||
* 如果在函数内部访问一个变量而没有对其进行赋值操作,Python 会先在局部作用域中查找该变量,如果找不到,则会在全局作用域中查找。
|
Loading…
Reference in New Issue
Block a user