I don't think there's a way to do it from the os module, but if you've got the win32 extensions installed this should do it : from win32file import GetLogicalDrives def GetDrives() : "Returns a list of valid drives on this system, in order" drives = [] driveMask = GetLogicalDrives() for i in range( 0, 31 ) : if driveMask & ( 1 << i ) : drives.append( chr( ord( 'a' ) + i ) ) return drives Matt Setzer "Volucris" <volucris at hotmail.com> wrote in message news:3aecd342$0$39601$6e49188b at news.goldengate.net... > Is there a way to get a list of the drives available (on win32: c:, a:, b:, > d:, etc.)? Ultimately, I want to make a file chooser in a Tkinter app. > Desperatly I tried > > os.listdir(os.path.abspath('c:\\..')) > > but that does nothing useful. Otherwise, I could just confine my users to a > single drive and say it's a security feature. > > greg > >
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4