Skip to content

Conversation

@DavidYoung93
Copy link
Contributor

03002 刘洪义 期中作业第一次提交

allFiles.append(filename)
return (allPath,allFiles)

def setNewPath(original_path,target_path):#根绝原始文件目录创建新路径下的文件夹目录
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc string 应该放在函数体内,像这样:

def setNewPath(original_path,target_path):
    """根绝原始文件目录创建新路径下的文件夹目录"""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其他的函数一样

#print(target_name)
if not os.path.exists(target_name):
os.makedirs(target_name)
def creatfolder(target_path):#根据收到的maya文件名称创建集号,镜头号等..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create_folders这个名字会不会更好点?

if not os.path.exists(temp_ep_path):
#print(temp_ep_path)
os.makedirs(temp_ep_path)
for i in cam:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嵌套循环里,循环变量都是i是不行的

if not os.path.exists(temp_cam_path):
os.makedirs(temp_cam_path)

def getNum(original_path):#根据给到的maya文件名称获得集号镜头号等..
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

函数名PEP8风格要求——get_num

cam = []
joinpath =[]
'''allFiles = ["ep05_sc001_cam001_v001", "ep06_sc001_cam002a_v004", "ep06_sc003_cam001b_v002", "ep04_sc003_cam009H_v002",
"ep06_sc004_cam001a-v001"]'''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种注释不能留在代码里

cam.append(num[0][1]+"\\"+num[0][2])
joinpath.append(num[0][0]+"\\"+num[0][1]+"\\"+num[0][2])
#print(num[0][0])
return(ep,sc,cam,joinpath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

四个同样元素数量的列表,这个结构不够合理。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return 一个由列表组成的元组,这种方式不合理。

temp_cam_path = os.path.join(temp_ep_path,i)
if not os.path.exists(temp_cam_path):
os.makedirs(temp_cam_path)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

函数之间空两行,参考PEP8

count = 0
Projectinformation = os.path.join(projectpath, 'Projectinformation.txt')
for root , dirs, files in os.walk(original_path):
for name in files:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

嵌套循环略丑陋

else:
shutil.copy(base_name, target_name)
os.rename(target_name,target_final_name)
else:#如果复制文件夹内有子文件夹,则把子目录文件复制到目标路径根目录下
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

表扬一下: 在这种复杂的逻辑中,写了注释,这是很好的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants