代码如下

将遍历出来的路径全部添加到列表中:

def get_all_abs_path(source_dir):
    path_list = []
    for fpathe, dirs, fs in os.walk(source_dir):
        for f in fs:
            p = os.path.join(fpathe, f)
            path_list.append(p)
    return path_list

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-27
  • 2022-12-23
  • 2022-12-23
  • 2022-01-09
  • 2022-12-23
  • 2021-09-27
相关资源
相似解决方案