Question: Python Question We are writing a text editing program that periodically saves a backup copy of the open edited file whose full file path is
Python Question

We are writing a text editing program that periodically saves a backup copy of the open edited file whose full file path is stored in string variable fullpath. The name of the backup file starts with "bak_" and is followed by the name of the edited file. For example, if the edited file path is "/home/user/p1.py", then the path name of the backup file is /home/user/bak-pipy. Which code sequence among the following generates the correct path name for the backup file in variable backup_path in a way that does not depend on the operating system? t-os.path.split(fullpath) backup_path -os.path.join(t[0], "bak_"+ t[1]) t-os.path.split(fullpath) backup_pathos.path.join(t[1], "bak_" t[0]) t os.path.split(fullpath) backup_path t[0]""bak_" t[1] tos.path.splitext(fullpath) backup_path - os.path.join(t[e], "bak_"[1])
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
