glob获取相关路径

来源:互联网 发布:淘宝图片尺寸和大小 编辑:程序博客网 时间:2024/05/22 15:28
def get_all_checkout_file():    '''利用glob获取相关路径'''    import glob    glob_path = os.path.join(PATH, '0709modify', 'cuted_varify_sample_pinyin_role_checkout*')    matched_path_list =  glob.glob(glob_path)    # print matched_path_list, len(matched_path_list)    filename_to_write = os.path.join(PATH, '0709modify', 'checkout.txt')    with codecs.open(filename_to_write, mode='wb', encoding='utf-8') as wf:        all_content = [wf.writelines(codecs.open(item, encoding='utf-8').readlines()) for item in matched_path_list]# get_all_checkout_file()

0 0
原创粉丝点击