区别项

粗体为推荐选择

架构

  • i686:32位x86
  • x86_64:64位x86_64

线程模型

  • win32:基于 Windows 原生线程(Windows API)
  • posix:基于 POSIX 线程标准
  • mcf:Mingw-w64 C Library Fork, mingw-w64 项目的一个特定优化版本

运行时

  • msvcrt:Microsoft Visual C Runtime Library (VC6)
  • ucrt:Universal C Runtime Library (Win10起)
阅读全文 »

1. 测试网络层是否正常

ping example.com

2. 测试HTTP是否可以连接

curl -I https://example.com
wget -q --spider https://example.com

3. 通过telnet端口测试

telnet example.com 80

解决方案

编码参数encoding使用utf-8-sig而非utf-8,可以自动去除多种标准的文件头BOM。

1
2
with open('file.txt', 'r', encoding='utf-8-sig') as f:
content = f.read()

额外说明

codecs模块中包括BOMBOM_UTF8BOM_BEBOM_UTF32_LE等常量。

参考资料

  1. codecs — Codec registry and base classes
    codecs --- 编解码器注册和相关基类

假设文件目录关系如下

1
2
3
4
root
├─test
│ └─test_code.py
└─root_code.py

若要从test_code.py引入root_code.py模块,则test_code.py应当实现:

test/test_code.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import os
import sys

# print(sys.path)
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..',)))
# print(sys.path)

import root_code
# or
from root_code import *

...
阅读全文 »

方法一:使用图形界面

  1. 打开设置窗口
    • GNOME安装gnome-startup-applications(20.04后);在控制中心(Control Center)中寻找Startup Applications程序;或是在控制中心寻找Startup Applications Preferences选项[1]
    • MATE在控制中心(Control Center)中寻找Startup Applications选项[2]
  2. 增加启动项
    • Startup Applications Preferences窗口中新增项目,填写名称和命令。
  3. 重启检查效果
阅读全文 »
0%