model_combine.py 615 字节
Newer Older
xiebaiyuan's avatar
xiebaiyuan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# coding=utf-8
import os

path = "yolo_v2_tofile_source/"  # 文件夹目录
to_file_path = "yolo_v2_tofile_combined/params"
files = os.listdir(path)  # 得到文件夹下的所有文件名称
files.sort(cmp=None, key=str.lower)
to_file = open(to_file_path, "wb")

for file in files:  # 遍历文件夹
    if not os.path.isdir(file):  # 判断是否是文件夹,不是文件夹才打开
        f = open(path + "/" + file)  # 打开文件
        name = f.name
        print 'name:  ' + name
        from_file = open(name, "rb")
        to_file.write(from_file.read())
        from_file.close()

to_file.close()