In the code below I have a class that handles what folder the user is in, so they can browse through multiple folders. I know that this isn't going to work right just yet.
This is the first time I've tried using classes and I don't understand them so well. So I probably mucked something up somewhere.
This code seems like it's going to work, but I get an odd error when it tries to print the contents of the folder the user types.
class GetFoldersInDir:
def DirName(self,directory):
os.system("cls")
self.directory = directory
print "Folders in %s\n" % directory
for folder in os.listdir(directory):
print folder
return self.directory
def delete():
Get = GetFoldersInDir()
Get.DirName("R:/")
choice = raw_input("\nType del to delete something, type a folder's name to open it.\n")
if choice == "del":
print "@@@@@@"
elif choice in os.listdir(Get.directory):
Get.DirName(choice)
else:
print "Folder not found."
print Get.directory
WindowsError: [Error 3] The system cannot find the path specified: 'Old/*.*'
Why does it add /*.* to what I type? :?: