MCPcopy Index your code
hub / github.com/geekcomputers/Python / main

Function main

dir_test.py:19–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17
18
19def main():
20 CheckDir = input("Enter the name of the directory to check : ")
21 print()
22
23 if os.path.exists(CheckDir): # Checks if the dir exists
24 print("The directory exists")
25 else:
26 print("No directory found for " + CheckDir) # Output if no directory
27 print()
28 option = input("Would you like this directory create? y/n: ")
29 if option == "n":
30 print("Goodbye")
31 exit()
32 if option == "y":
33 os.makedirs(CheckDir) # Creates a new dir for the given name
34 print("Directory created for " + CheckDir)
35 else:
36 print("Not an option. Exiting")
37 exit()
38
39
40if __name__ == "__main__":

Callers 1

dir_test.pyFile · 0.70

Calls 1

exitFunction · 0.85

Tested by

no test coverage detected