GeezerVison is showing github.com — p3 · deepminder/StarterLearningPython@51ee68a
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: 228.md +6Lines changed: 6 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -67,7 +67,13 @@ pip就这样安装好了,非常简单吧。 |
67 | 67 |
|
68 | 68 | ###安装 |
69 | 69 |
|
| 70 | +Python 2: |
| 71 | + |
70 | 72 | pip install requests |
| 73 | + |
| 74 | +Python 3: |
| 75 | + |
| 76 | + pip3 install requests |
71 | 77 |
|
72 | 78 | 安装好之后,在交互模式下: |
73 | 79 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: 238.md +2-2Lines changed: 2 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
|
4 | 4 |
|
5 | 5 | ##方法 |
6 | 6 |
|
7 | | -在类里面,除了属性,就是方法,当然还有注释和文档,但这些是计算机不看的,只是给人看的。 |
| 7 | +在类里面,除了属性,就是方法,当然还有注释和文档,但计算机不看它们的,只是人看的。 |
8 | 8 |
|
9 | 9 | 关于方法,在通常情况下用实例调用。但是,跟方法有关的一些深入的话题,还需要辨析。 |
10 | 10 |
|
@@ -52,7 +52,7 @@ Python 2的报错信息是: |
52 | 52 | Foo.bar() |
53 | 53 | TypeError: bar() missing 1 required positional argument: 'self' |
54 | 54 |
|
55 | | -不管你是用什么版本,最好都阅读上述两个报错信息。在Python 2的报错信息中,告诉我们`barr()`是非绑定方法,它必须以`Foo`的实例作为第一个参数;Python 3的报错信息也是告诉我们`bar()`缺少一个必须的参数`self`,它也是一个实例。所以,不管哪个版本,都要传一个实例。 |
| 55 | +不管你是用什么版本,最好都阅读上述两个报错信息。在Python 2的报错信息中,告诉我们`bar()`是非绑定方法,它必须以`Foo`的实例作为第一个参数;Python 3的报错信息也是告诉我们`bar()`缺少一个必须的参数`self`,它也是一个实例。所以,不管哪个版本,都要传一个实例。 |
56 | 56 |
|
57 | 57 | Python中一切皆对象——又是老生常谈,都是因为此观念之重要。类`Foo`的方法`bar()`也是对象——函数对象,那么,我们就可以像这样来获得该对象了。 |
58 | 58 |
|
|