import os
import datetime
def file_date(filename):
# Create the file in the current directory
with open (filename,'w') as file:
pass
timestamp = [Link](filename)
c=[Link](timestamp)
# Convert the timestamp into a readable format, then into a string
# Return just the date portion
# Hint: how many characters are in “yyyy-mm-dd”?
return ("{}".format([Link]("%Y-%m-%d")))
print(file_date("[Link]"))
# Should be today's date in the format of yyyy-mm-dd
import os
def new_directory(directory, filename):
# Before creating a new directory, check to see if it already exists
if [Link](directory) == False:
[Link](directory)
# Create the new file inside of the new directory
[Link](directory)
with open (filename, "w") as file:
pass
[Link]("..")
# Return the list of files in the new directory
return [Link](directory)
print(new_directory("PythonPrograms", "[Link]"))
import os
def parent_directory():
# Create a relative path to the parent
# of the current working directory
relative_parent = [Link]([Link](), [Link])
# Return the absolute path of the parent directory
return [Link](relative_parent)
print(parent_directory())