Python - Standard Library Usage
You want to create a new directory named 'backup' only if it does not exist. Which code snippet correctly does this?
os.mkdir() creates a directory but raises error if it exists.os.path.exists() to check prevents error by creating only if missing.os.makedirs() can create nested dirs but without check may error; calling mkdir twice causes error.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions