Question
Match the descriptions on the left with the correct methods or attributes on the right from the sys and os modules. 1. determines what operating
Match the descriptions on the left with the correct methods or attributes on the right from the sys and os modules.
1. determines what operating system is being used where the Python program is running
[ Choose ] import os os.getcwd( ) os.path.isfile(path) os.rmdir(path) import sys sys.platform os.path.abspath(path) os.path.join os.path.exists(path) os.chdir(path) os.listdir( ) os.mkdir(path) os.rename(src, dst) os.path.isdir(path)
2. returns a string containing the current working directory path
[ Choose ] import os os.getcwd( ) os.path.isfile(path) os.rmdir(path) import sys sys.platform os.path.abspath(path) os.path.join os.path.exists(path) os.chdir(path) os.listdir( ) os.mkdir(path) os.rename(src, dst) os.path.isdir(path)
3. changes the current working directory to path
[ Choose ] import os os.getcwd( ) os.path.isfile(path) os.rmdir(path) import sys sys.platform os.path.abspath(path) os.path.join os.path.exists(path) os.chdir(path) os.listdir( ) os.mkdir(path) os.rename(src, dst) os.path.isdir(path)
4. returns a list of the files and directories in the current working directory
[ Choose ] import os os.getcwd( ) os.path.isfile(path) os.rmdir(path) import sys sys.platform os.path.abspath(path) os.path.join os.path.exists(path) os.chdir(path) os.listdir( ) os.mkdir(path) os.rename(src, dst) os.path.isdir(path)
5. creates a new directory at path
[ Choose ] import os os.getcwd( ) os.path.isfile(path) os.rmdir(path) import sys sys.platform os.path.abspath(path) os.path.join os.path.exists(path) os.chdir(path) os.listdir( ) os.mkdir(path) os.rename(src, dst) os.path.isdir(path)
6. deletes the directory at path if it is empty
[ Choose ] import os os.getcwd( ) os.path.isfile(path) os.rmdir(path) import sys sys.platform os.path.abspath(path) os.path.join os.path.exists(path) os.chdir(path) os.listdir( ) os.mkdir(path) os.rename(src, dst) os.path.isdir(path)
7. renames the file or directory in src to the file or directory in dst
[ Choose ] import os os.getcwd( ) os.path.isfile(path) os.rmdir(path) import sys sys.platform os.path.abspath(path) os.path.join os.path.exists(path) os.chdir(path) os.listdir( ) os.mkdir(path) os.rename(src, dst) os.path.isdir(path)
8. convert a relative path into an absolute path
[ Choose ] import os os.getcwd( ) os.path.isfile(path) os.rmdir(path) import sys sys.platform os.path.abspath(path) os.path.join os.path.exists(path) os.chdir(path) os.listdir( ) os.mkdir(path) os.rename(src, dst) os.path.isdir(path)
9. returns True if path refers to an existing file
[ Choose ] import os os.getcwd( ) os.path.isfile(path) os.rmdir(path) import sys sys.platform os.path.abspath(path) os.path.join os.path.exists(path) os.chdir(path) os.listdir( ) os.mkdir(path) os.rename(src, dst) os.path.isdir(path)
10. returns True if path refers to an existing directory
[ Choose ] import os os.getcwd( ) os.path.isfile(path) os.rmdir(path) import sys sys.platform os.path.abspath(path) os.path.join os.path.exists(path) os.chdir(path) os.listdir( ) os.mkdir(path) os.rename(src, dst) os.path.isdir(path)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started