0

My folder name as movie title and after extracting movie name as folder in python then it will be use as a movie title to find out the movie discription by usnibg omdb API and then find out the rate of the movie when we seen the movie rate then the folder will be deleted

3
  • 1
    I don't understand the question. Are you asking how to turn a path like "/foo/bar/baz" into just "baz"? Commented Aug 16, 2018 at 20:30
  • Can you post some code to show us what you are trying to do? Commented Aug 16, 2018 at 20:31
  • Please try to invest some time into writing complete sentences. As it is, this question is going to end up being deleted. Commented Aug 16, 2018 at 20:33

1 Answer 1

1
os.walk(top, topdown=Ture, onerror=None, followlinks=False)

The walk() function in module os can traverse all files in a folder.

The function returns a tupple(dirpath, dirnames, filenames).

Parameters:

dirpath:string, the path of directory,

dirnames:list, includes all directories’ name

filenames:list,includes all files’ name.

p.s.

dirnames and filenames didn’t include the path information, if you need entire path, use os.path.join(dirpath, dirnames)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.