python 删除文件夹所有顺坏无法打开的视频
import os
import cv2
from glob import glob
filePath = 'D:/b/'
cap=os.listdir(filePath)
for i in cap:
cap = cv2.VideoCapture(filePath+i)
s=cap.isOpened()
if s==False:
os.remove(filePath+i)
import os
import cv2
from glob import glob
filePath = 'D:/b/'
cap=os.listdir(filePath)
for i in cap:
cap = cv2.VideoCapture(filePath+i)
s=cap.isOpened()
if s==False:
os.remove(filePath+i)