Notes / Module

Python

This section organizes my public notes on Python fundamentals.

3 ordinary notes and 1 index note in this branch.

Entrance

Index Note

The readable index note for this branch stays at its flat canonical URL.

Python Notes

This section organizes my public notes on Python fundamentals.

module-index

Notes

Notes in This Module

Ordinary notes link to their unchanged flat note URLs.

seedProgramming Languages

Python 基础知识

1. 文件是存储在辅助存储器上的一组数据序列,可以包含任何数据内容。 2. 文件包括文本文件和二进制文件两种类. 型。 3. 文本文件和二进制文件的存储方式不同。 4. Python 为源文件指定的默认字符编码是UTF-8 5. 文件的打开方式对应为: ‘r’:只读方式 ‘w’:只写方式,若文件存在,覆盖原来内容 ‘a’:只写方式若文件存在,内容追加在原文件内容后面 ‘t’:文本文件模式 ‘b’:二进制文件模式 ‘x’:创建写模式,文件不存在则创建,存在则返回异常FileEx

Jul 11, 2026 / learning-note

seedProgramming Languages

Python 常用库函数

random库是Python的标准库,用于产生各种分布的伪随机数序列。 它采用梅森旋转算法生成伪随机数序列。 1. random.random(): 返回随机生成的一个浮点数,范围在[0,1)之间 2. random.uniform(a, b): 返回随机生成的一个浮点数,范围在[a, b)之间 3. random.randint(a,b): 返回随机生成的[a,b]之间的整数 4. random.randrange(a, b, step=c): 在指定范围内,在指定的基数和

Jul 11, 2026 / learning-note