def del_httpd_user(username): if os.path.isfile(SVN_HTTPD_USERS): shutil.copyfile(SVN_HTTPD_USERS, SVN_HTTPD_USERS + '.' + get_now_time2()) else: create_new_file(SVN_HTTPD_USERS, 'utf-8') subprocess.check_output(['htpasswd', '-D', SVN_HTTPD_USERS, username]).decode('utf-8').strip()
def check_file_exists(filepath): #如果文件已经存在,则重命名之 if os.path.isfile(filepath): os.rename(filepath, filepath + '.' + get_now_time2()) create_new_file(filepath, 'utf-8')