【发布时间】:2020-11-04 14:40:47
【问题描述】:
我试图遍历目录中的文件,如下所示:
with open(video_list, 'r') as imf:
index = []
for id, line in enumerate(imf):
video_label = line.strip().split()
video_name = video_label[0] # name of video
label = rectify_label[video_label[1]] # label of video
video_path = os.path.join(video_root, video_name) # video_path is the path of each video
### for sampling triple imgs in the single video_path ####
img_lists = os.listdir(video_path)
img_lists.sort() # sort files by ascending
img_count = len(img_lists) # number of frames in video
num_per_part = int(img_count) // 3
但即使文件存在,Python 也会抛出 FileNotFoundError:
---> 36 img_lists = os.listdir(video_path)
37 img_lists.sort() # sort files by ascending
38 img_count = len(img_lists) # number of frames in video
FileNotFoundError: [WinError 3] 系统找不到指定的路径:'C:/Users/m_rayeni/Emotion-FAN/Data/Train/Fear/013736360'
那么这里出了什么问题?
【问题讨论】:
标签: python