What is the correct way to delete a directory that is not empty using Python?
Correct Answer: import shutil shutil.rmtree('/directory')
Explanation:
Note: This Question is unanswered, help us to find answer for this one
Python Skill Assessment
Your Skill Level: Poor
Retake Quizzes to improve it
More Python MCQ Questions
Which is the correct way to write a generator which will output the numbers between 1 and 100 (inclusive)?
Which code snippets concatenates the list a_list = [1, 2, 3] with the tuple a_tuple = (4, 5), so the result would be [1, 2, 3, 4, 5]?
Sometimes, an object needs to be converted into its string representation. Fortunately, the object class provides functionality for this. Which of the following returns a string representation of the object 'self'?
Which code snippet convert the hexademical number 0x1000 to a decimal correctly?
Output of the following code? def change_list(list1, list2): list1.append('four') list2 = ['and', 'we', 'can', 'not', 'lie'] outer_list1 = ['one', 'two', 'three'] outer_list2 = ['we', 'like', 'proper', 'English'] change_list(outer_list1, outer_list2) print outer_list1 print outer_list2
Correct ways to test if a key exists in a dictionary?
Which will determine the number of CPUs available in the operating environment?
Which of the following is the correct way to recursively find files with the extension ".html" in the directory "site" with Python?
Read the following code: def approx(x): if hasattr(x,'__and__'): return x & ~0x0FL try: return (round(x.real,2)+round(x.imag,2)*1j) exception AttributeError: return round(x,2) Which of the following lines is incorrect in the above code?
Given a program that has different combinations of conditions, programming a custom function for each combined condition can produce an excessive number of functions. Instead, for conditions that should be jointly satisfied, several filters can be nested within each other. Which of the following statements does this correctly?