短视频PHP源码python批量获取图像路径txt

#导入对路径操作的库
import sys
import os 

#图像路径
root_path = 'home/ll/'
#将每个图像的路径保存为txt
fns = os.listdir(root_path)
with open('image_list.txt', 'w') as f:
	for fn in fns:
		path = os.path.join(root_path, fn)
		f.wirte('{}\n'.format(path))
		print path
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章