CopyProject02

Today I start copying the code of enterprise code .

Because I really don't understand the requirement so I typed first two functions.

  • The first function is check whether the folder exists

  • The second function is create a folder if there's no old target folder.

    # This is a system to generate the Enterprise code
    #the function below is used to create the folder
    def mkdir (path):
        isexists = os.path.exists (path)  # Check whether the folder exists 
        if not isexists:
            os.mkdir(path)   # create a folder
    
    # this is a funtion of reading the content  and closing folder
    def openfile(filename):
        f = open (filename)
        fllist = f.read() 
        f.close()
        return fllist
    
    • Don't settle for average.Bring the best to your moment.
python
116 views
Comments
登录后评论
Sign In
·

貌似第一段代码和你第二段描述是匹配的

第二段代码是打开一个文件并返回文件内容,并不是检查文件是否存在