def validateTitle(title): rstr = r"[/\:*?"<>|]" # '/ : * ? " < > |' new_title = re.sub(rstr, "_", title) # 替换为下划线 return new_title
获取文件的总数
def get_total_files(mkpath): return sum([len(x) for _, _, x in os.walk(os.path.dirname(mkpath))])