(filepath, dirmode=0700, filemode=0600)
Creates a new file
Creates a new file
Creates a new file
def create_file(filepath, dirmode=0700, filemode=0600):
    """
    Creates a new file
    """
    if not os.path.isfile(filepath):
        # if the base dir doesn't exist we need to create it first
        basedir = os.path.dirname(filepath) 
        if not os.path.isdir(basedir):
            os.makedirs(os.path.dirname(filepath), dirmode)
        # create the file
        f = open(filepath, 'w+')
        f.write('')
        f.close()
        os.chmod(filepath, filemode)
        return True
    else:
        return False
def create_file ( filepath , dirmode = 0700 , filemode = 0600 ) : if not os . path . isfile ( filepath ) : # if the base dir doesn't exist we need to create it first basedir = os . path . dirname ( filepath ) if not os . path . isdir ( basedir ) : os . makedirs ( os . path . dirname ( filepath ) , dirmode ) # create the file f = open ( filepath , 'w+' ) f . write ( '' ) f . close ( ) os . chmod ( filepath , filemode ) return True else : return False