I just learned about dictionaries in Python and tried to implement them into a program I developed.
The folders in the dictionary absolutely MUST be created in the listed order. But if for whatever reason they cannot be created, I want the name I specify to be printed instead of the entire directory name, like it did when I a list in this section of code. If that doesn't make much sense you'll see what I mean in the code...I hope.
Using a dictionary would be perfect for doing what I want, except it automatically sorts the contents! This totally breaks the program! :confused:
FrameFolders = {modsDir:"Mods", Packages:"Packages", DCCache:"DCCache"}
for path in FrameFolders:
if not os.path.isdir(path):
Ok = False
print "%s folder does not exist. Creating..." % FrameFolders[path]
#Just using % path prints the ENTIRE directory name
os.mkdir(path)
if os.path.isdir(path): print "Folder sucessfully created.\n"
else: raise NotFoundError("Could not create %s folder!" % FrameFolders[path])
Is there some workaround or something I can use in the place of a dictionary to get the results I want?