Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Python-100-Days
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huangkq
Python-100-Days
Commits
bef6a30a
Commit
bef6a30a
authored
May 06, 2019
by
jackfrued
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更正了部分文档中的bug
parent
2c1991cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
初识Python.md
Day01-15/Day01/初识Python.md
+4
-4
面向对象编程基础.md
Day01-15/Day08/面向对象编程基础.md
+2
-2
文件和异常.md
Day01-15/Day11/文件和异常.md
+1
-1
No files found.
Day01-15/Day01/初识Python.md
View file @
bef6a30a
...
@@ -53,15 +53,15 @@ yum -y install wget gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlit
...
@@ -53,15 +53,15 @@ yum -y install wget gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlit
下载Python源代码并解压缩到指定目录。
下载Python源代码并解压缩到指定目录。
```
Shell
```
Shell
wget https://www.python.org/ftp/python/3.7.
0/Python-3.7.1.tar.x
z
wget https://www.python.org/ftp/python/3.7.
3/Python-3.7.3.tg
z
xz -d Python-3.7.
1
.tar.xz
xz -d Python-3.7.
3
.tar.xz
tar -xvf Python-3.7.
1
.tar
tar -xvf Python-3.7.
3
.tar
```
```
切换至Python源代码目录并执行下面的命令进行配置和安装。
切换至Python源代码目录并执行下面的命令进行配置和安装。
```
Shell
```
Shell
cd Python-3.7.
1
cd Python-3.7.
3
./configure --prefix=/usr/local/python37 --enable-optimizations
./configure --prefix=/usr/local/python37 --enable-optimizations
make && make install
make && make install
```
```
...
...
Day01-15/Day08/面向对象编程基础.md
View file @
bef6a30a
...
@@ -157,7 +157,7 @@ class Clock(object):
...
@@ -157,7 +157,7 @@ class Clock(object):
if self._hour == 24:
if self._hour == 24:
self._hour = 0
self._hour = 0
def
__str__
(self):
def
show
(self):
"""显示时间"""
"""显示时间"""
return '%02d:%02d:%02d' % \
return '%02d:%02d:%02d' % \
(self._hour, self._minute, self._second)
(self._hour, self._minute, self._second)
...
@@ -166,7 +166,7 @@ class Clock(object):
...
@@ -166,7 +166,7 @@ class Clock(object):
def main():
def main():
clock = Clock(23, 59, 58)
clock = Clock(23, 59, 58)
while True:
while True:
print(clock)
print(clock
.show()
)
sleep(1)
sleep(1)
clock.run()
clock.run()
...
...
Day01-15/Day11/文件和异常.md
View file @
bef6a30a
...
@@ -103,7 +103,7 @@ if __name__ == '__main__':
...
@@ -103,7 +103,7 @@ if __name__ == '__main__':
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
```
Python
from math import sqrt
from math import sqrt
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment