2024-09-27 02:23:23 发布
网友
我的文件夹名称作为电影标题,在python中提取电影名称作为文件夹后,它将被用作电影标题,通过usnibg omdb API找到电影描述,然后找到电影的速率当我们看到电影速率时,文件夹将被删除
os.walk(top, topdown=Ture, onerror=None, followlinks=False)
module os中的walk()函数可以遍历文件夹中的所有文件
函数返回一个元组(dirpath、dirnames、filenames)
参数:
dirpath:string, the path of directory,dirnames:list, includes all directories’ namefilenames:list,includes all files’ name.
dirpath:string, the path of directory,
dirnames:list, includes all directories’ name
filenames:list,includes all files’ name.
附言
目录名和文件名不包含路径信息,如果需要完整的路径,请使用os.path.join(目录路径,目录名)
module os中的walk()函数可以遍历文件夹中的所有文件
函数返回一个元组(dirpath、dirnames、filenames)
参数:
附言
目录名和文件名不包含路径信息,如果需要完整的路径,请使用os.path.join(目录路径,目录名)
相关问题 更多 >
编程相关推荐