File tree Expand file tree Collapse file tree 3 files changed +42
-4
lines changed
Expand file tree Collapse file tree 3 files changed +42
-4
lines changed Original file line number Diff line number Diff line change 1515# import pattern.Composite
1616# import pattern.Clone
1717# import pattern.Builder
18- import pattern .Adapter
18+ # import pattern.Adapter
1919# import pattern.Strategy
2020# import pattern.Command
2121# import pattern.Memento
3131# import advanced_pattern.Callback
3232
3333# import application.ImageProcessing
34- # import principle.Principle
34+ import principle .Principle
Original file line number Diff line number Diff line change 1+ #!/usr/bin/python
2+ # Authoer: Spencer.Luo
3+ # Date: 8/11/2018
4+
5+ import os
6+ # 导入os库,用于文件、路径相关的解析
7+
8+ # def getPath(basePath, fileName):
9+ # extName = os.path.splitext(fileName)[1]
10+ # filePath = basePath
11+ # if(extName.lower() == ".txt"):
12+ # filePath += "/txt/"
13+ # elif(extName.lower() == ".pdf"):
14+ # filePath += "/pdf/"
15+ # else:
16+ # filePath += "/other/"
17+ #
18+ # # 如果目录不存在,则创建新目录
19+ # if (not os.path.exists(filePath)):
20+ # os.makedirs(filePath)
21+ #
22+ # filePath += fileName
23+ # return filePath
24+
25+ def getPath (basePath , fileName ):
26+ extName = fileName .split ("." )[1 ]
27+ filePath = basePath + "/" + extName + "/"
28+
29+ # 如果目录不存在,则创建新目录
30+ if (not os .path .exists (filePath )):
31+ os .makedirs (filePath )
32+
33+ filePath += fileName
34+ return filePath
35+
36+ print (getPath ("E:/upload" , "TestFile.rar" ))
37+ print (getPath ("E:/upload" , "Design Pattern for Python.pdf" ))
Original file line number Diff line number Diff line change 55
66# from . import SRP
77# from . import OCP
8- from . import LSP
8+ # from . import LSP
99# from . import DIP
1010# from . import LoD
11- # from . import ISP
11+ # from . import ISP
12+ from . import DRY
You can’t perform that action at this time.
0 commit comments