I used the following code to read all files in a folder:
files_path = [os.path.abspath(x) for x in os.listdir()]
fnames_transfer = [x for x in files_path if x.endswith(".mkv")]
Now I need to extract the name of the file except its directory. For example fnames_transfer
is E:\pythoncode\feature\1.mkv
. I need to extract 1.mkv
from this string. What should I do for this?