Directory in Windows
Hi,..I tried to list files in a tree directory using os.path.walk. To avoid dirnames fromm being listed i use the os.path.isdir method. However, when isdir encounters directories that use spaces in their name e.q My Documents it doesn;t recognize them as directories.. Is there any solution to this,..pertaining that I want to keep the naming of my directories? -- http://mail.python.org/mailman/listinfo/python-list
Re: Directory in Windows
Here's my code filelist={} def listFiles(self, dirName, filesInDir): for fname in filesInDir: if os.path.isfile(fname): key = os.path.join(dirName, fname) stats = os.stat(fname) filelist[key] = (stats[stat.ST_MTIME], stats[stat.ST_SIZE]) os.path.walk(string.strip(self.path.get()), listFiles, None) print filelist === I change: if not os.path.isdir(fname) to if os.path.isfile(fname) because some directories are not recognized as directory, and I get an error message because os.stat is called with the directory as arg. But even after I change it into isfile(). There are still some errors,..some images in the subdirectories won't get printed... Help please -- http://mail.python.org/mailman/listinfo/python-list
Displaying formatted - data with TKinter
Hi,..I found it difficult to display data from a dictionary using GUI. What widget should I use? I tried using text widget, but I couldn't get the display I want. I need the display to look like this file name size agelocation fdssfdfsa 3034safasfafsfdsa asdfafdsafs 4556asdffdsafsd And I'm getting the display from inside a dictionary that holds list as its value. Any suggestion on what I should use to display the data in that format?? -- http://mail.python.org/mailman/listinfo/python-list
sorting list and then return the index of the sorted item
I need help sorting a list...I just can't figure out how to sort a list and then return a list with the index of the sorted items in the list for example if the list I want to sort is [2,3,1,4,5] I need [2,0,1,3,4] to be returned Can someone help please -- http://mail.python.org/mailman/listinfo/python-list
Re: sorting list and then return the index of the sorted item
Okay...THanks a lot everyone,.. Those codes really help -- http://mail.python.org/mailman/listinfo/python-list
Re: sorting list and then return the index of the sorted item
Okay...THanks a lot everyone,.. Those codes are a real help -- http://mail.python.org/mailman/listinfo/python-list