Skip to content

Commit

Permalink
更正了部分文档中的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrued committed May 6, 2019
1 parent 2c1991c commit bef6a30
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Day01-15/Day01/初识Python.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ yum -y install wget gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlit
下载Python源代码并解压缩到指定目录。

```Shell
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.1.tar.xz
xz -d Python-3.7.1.tar.xz
tar -xvf Python-3.7.1.tar
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
xz -d Python-3.7.3.tar.xz
tar -xvf Python-3.7.3.tar
```

切换至Python源代码目录并执行下面的命令进行配置和安装。

```Shell
cd Python-3.7.1
cd Python-3.7.3
./configure --prefix=/usr/local/python37 --enable-optimizations
make && make install
```
Expand Down
4 changes: 2 additions & 2 deletions Day01-15/Day08/面向对象编程基础.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class Clock(object):
if self._hour == 24:
self._hour = 0

def __str__(self):
def show(self):
"""显示时间"""
return '%02d:%02d:%02d' % \
(self._hour, self._minute, self._second)
Expand All @@ -166,7 +166,7 @@ class Clock(object):
def main():
clock = Clock(23, 59, 58)
while True:
print(clock)
print(clock.show())
sleep(1)
clock.run()

Expand Down
2 changes: 1 addition & 1 deletion Day01-15/Day11/文件和异常.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ if __name__ == '__main__':
main()
```

要将文本信息写入文件文件也非常简单,在使用`open`函数时指定好文件名并将文件模式设置为`'w'`即可。注意如果需要对文件内容进行追加式写入,应该将模式设置为`'a'`。如果要写入的文件不存在会自动创建文件而不是引发异常。下面的例子演示了如何将1~9999直接的素数分别写入三个文件中(1~99之间的素数保存在a.txt中,100~999之间的素数保存在b.txt中,1000~9999之间的素数保存在c.txt中)。
要将文本信息写入文件文件也非常简单,在使用`open`函数时指定好文件名并将文件模式设置为`'w'`即可。注意如果需要对文件内容进行追加式写入,应该将模式设置为`'a'`。如果要写入的文件不存在会自动创建文件而不是引发异常。下面的例子演示了如何将1-9999直接的素数分别写入三个文件中(1-99之间的素数保存在a.txt中,100-999之间的素数保存在b.txt中,1000-9999之间的素数保存在c.txt中)。

```Python
from math import sqrt
Expand Down

0 comments on commit bef6a30

Please sign in to comment.