Movatterモバイル変換
[0]ホーム
drives in a file chooser
Matt Setzerdontspamsetzer at nwlink.com
Mon Apr 30 01:21:50 EDT 2001
I don't think there's a way to do it from the os module, but if you'vegot the win32 extensions installed this should do it :from win32file import GetLogicalDrivesdef 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 drivesMatt Setzer"Volucris" <volucris at hotmail.com> wrote in messagenews: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 toa> single drive and say it's a security feature.>> greg>>
More information about the Python-listmailing list
[8]ページ先頭