-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3fc7b1
commit 91339f2
Showing
21 changed files
with
481 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
docs/Computer Science/Programming Language/C++/Object Oriented Programming.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
# Object Oriented Programming | ||
|
||
!!! info | ||
本部分对应 《C++之旅》的第三章到第七章,并且包含了《C++ Primer》的某些内容。主要是以实现类似于标准库 `vector` 的容器类 `Vector` 为例。 | ||
|
||
## Template | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
docs/Computer Science/Programming Language/Python/01VariableAndTypes.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# 01 Variable and Types | ||
|
||
## Built-in Types | ||
|
||
|
||
### String | ||
|
||
#### f-string | ||
|
||
> 见 [f-strings from Python documentation](https://docs.python.org/3.11/reference/lexical_analysis.html#formatted-string-literals) | ||
|
||
|
||
|
||
### Interconversion between types | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 02 Input and Output | ||
|
||
|
||
|
||
|
||
## File I/O | ||
|
||
打开文件首先要使用 `open()` 函数,`open(filename, mode, encoding="utf-8")` 会返回一个 file object:第一个参数是包含了文件名的字符串;第二个参数是指定了文件使用方式的字符串,常见的有: | ||
|
||
- `r`:只读模式(默认); | ||
- `w`:只写模式,创建新文件(覆盖同名文件),并且先截断文件; | ||
- `a`:追加模式,打开一个文件用于追加到末尾,如果文件不存在则创建; | ||
- `*b`:`b` 作为后缀,表示二进制模式; | ||
- `+`:读写模式,打开用于更新; | ||
- `t`:文本模式(默认); | ||
|
||
默认的参数是 `r` 并且与 `rt` 同义,也就是通常情况下,文件是以 text mode 模式打开的,从文件中读写字符串,这些字符串是以特定的形式编码的,返回参数都是 `str`,可以在 `open()` 函数中指定 `encoding` 参数来指定编码方式,不然就以平台默认的字节编码解码。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Javascript | ||
|
||
## 1 Basic Syntax | ||
|
||
### 1.1 script 标签 | ||
|
||
可以使用 `<script>` 标签将 JavaScript 代码插入到 HTML 页面中,如果指定了 `src` 属性,就可以将外部的 JavaScript 文件引入到 HTML 页面中,同时 `<script>` 标签内的代码就会被忽略,一个单独的 `<script>` 标签不可以同时有 `src` 属性和内部代码。 | ||
|
||
```html | ||
<script src="script.js"></script> | ||
<script> alert('Hello, World!'); </script> | ||
``` | ||
|
||
### 1.2 代码结构 | ||
|
||
语句是执行行为/Action 的语法结构和命令,JavaScript 语句以分号 `;` 结尾并分割,但是如果在语句末尾存在换行符的时候,分号就大多情况下会自动插入。但是经常会有特殊的例子: | ||
|
||
<div class="grid" markdown> | ||
|
||
```javascript | ||
alert('Hello'); | ||
|
||
[1, 2].forEach(alert); | ||
``` | ||
|
||
```javascript | ||
alert('Hello') | ||
|
||
[1, 2].forEach(alert); | ||
``` | ||
|
||
</div> | ||
|
||
第二种情况会被视为 `alert('Hello')[1, 2].forEach(alert);`,就只会显示一个 `hello`,所以在 JavaScript 中,最好还是手动添加分号。 | ||
|
||
### 1.3 变量与常量 | ||
|
||
使用 `let` 或者 `var` 来创建一个变量,但是现代一般使用 `let`,比如 `let message` 就创建了一个名为 `message` 的变量,`message = "hello"` 就将 `message` 赋值成为 `hello`,变量名可以包含字母、数字、下划线和美元符号,甚至可以有非英文字母,但是不能以数字开头,同时推荐使用驼峰命名法。 | ||
|
||
不允许连续声明同一个变量,变量的值可以随时改变,JavaScript 是一种动态类型语言,变量的类型可以随时改变。 | ||
|
||
使用 `const` 可以创建一个常量,比如 `const BIRTHDAY = "28.08.2005` 就创建了一个常量,常量不可以被修改。 | ||
|
||
在教程给出的例子中,我们会发现其实下面的代码会输出 `John` 和 `John`,因为 `admin` 只是保存了 `name` 的值,而不是 `name` 的引用。 | ||
```javascript | ||
let name = "John", admin = name; | ||
alert(admin); | ||
name = "susy"; | ||
alert(admin); | ||
``` | ||
|
||
### 1.4 数据类型 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Chapter 1 The Birth of Civilization | ||
|
||
***Culture may be defined as the ways of living built up by a group and passed on from a generation to another.*** It includes behavior such as courtship and child-rearing practices; material things such as tools, clothing, and shelter; and ideas, institutions, and beliefs. **Language**, apparently a uniquely human trait, **lies behind our ability to create ideas and institutions and to transmit culture from one generation to another.** Our flexible and dexterous hands enable us to hold and make tools and so to create the material artifacts of culture. Because ***culture is learned and not inherited***, it permits rapid adaption to changing conditions, making possible the spread of humanity to almost all the lands of the globe. | ||
|
||
During the **Paleolithic**, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
# The Western Heritage | ||
|
||
!!! Info | ||
未完工!我会加紧进度的! | ||
|
||
!!! Warning | ||
本文仅作为本人对《The Western Heritage》一书的笔记,除记录知识以外再无其它意义 | ||
# The Western Heritage | ||
|
||
|
||
|
||
## *Chapter 1 The Birth of Civilization* | ||
## Table of Contents | ||
|
||
***Culture may be defined as the ways of living built up by a group and passed on from a generation to another.*** It includes behavior such as courtship and child-rearing practices; material things such as tools, clothing, and shelter; and ideas, institutions, and beliefs. **Language**, apparently a uniquely human trait, **lies behind our ability to create ideas and institutions and to transmit culture from one generation to another.** Our flexible and dexterous hands enable us to hold and make tools and so to create the material artifacts of culture. Because ***culture is learned and not inherited***, it permits rapid adaption to changing conditions, making possible the spread of humanity to almost all the lands of the globe. | ||
|
||
During the **Paleolithic**, |
Oops, something went wrong.