Merge pull request #21 from nasyxx/patch-2

Compliance with convention.
master
kenwoodjw 2019-03-05 21:56:37 +08:00 committed by GitHub
commit d0f7d5c7c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -305,12 +305,12 @@
以及其包含文件夹中文件的路径 以及其包含文件夹中文件的路径
""" """
import os import os
for sChild in os.listdir(sPath): for s_child in os.listdir(s_path):
sChildPath = os.path.join(sPath,sChild) s_child_path = os.path.join(s_path, s_child)
if os.path.isdir(sChildPath): if os.path.isdir(s_child_path):
print_directory_contents(sChildPath) print_directory_contents(s_child_path)
else: else:
print(sChildPath) print(s_child_path)
``` ```
# 模块与包 # 模块与包
## 2.1 输入日期, 判断这一天是这一年的第几天? ## 2.1 输入日期, 判断这一天是这一年的第几天?
@ -500,7 +500,7 @@ New 是真正创建实例对象的方法所以重写基类的new 方法,以
``` ```
import os import os
def getFiles(dir,suffix): def get_files(dir,suffix):
res = [] res = []
for root,dirs,files in os.walk(dir): for root,dirs,files in os.walk(dir):
for filename in files: for filename in files:
@ -510,7 +510,7 @@ New 是真正创建实例对象的方法所以重写基类的new 方法,以
print(res) print(res)
getFiles("./",'.pyc') get_files("./",'.pyc')
``` ```
第二种方法: 第二种方法:
``` ```