On May 20, 3:43 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > Mike Driscoll schrieb: > > > > > On May 20, 2:45 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > >> Bob Greschke wrote: > >>> This MUST have been asked before, but I can't seem to Google the right > >>> thing. How can I get a list of drives on a Windows box, like ["C:\", > >>> "D:\"], like I can if I do something like listdir("/Volumes") on a Mac? > >> A couple of options to get the ball rolling: > > >> 1) win32api.GetLogicalDriveStrings() > > > I gave this a go to see how it worked and ti gave me this: > > > 'A:\\\x00C:\\\x00D:\\\x00G:\\\x00I:\\\x00L:\\\x00P:\\\x00Q:\\\x00R:\\ > > \x00U:\\\x00X:\\\x00Y:\\\x00Z:\\\x00' > > > Not exactly what I expected. Do I have to parse out the "\\\x00" > > myself or is there an information level switch I should add? > > The data is separated by NUL bytes. Split it with \x00 and you'll get a > list of drives: > > "A:\\\x00C:\\\x00D:\\\x00G:\\\x00I:\\\x00L:\\\x00P:\\\x00Q:\\\x00R:\\\x00U:\\\x00X:\\\x00Y:\\\x00Z:\\\x00".split("\x00") > ['A:\\', 'C:\\', 'D:\\', 'G:\\', 'I:\\', 'L:\\', 'P:\\', 'Q:\\', 'R:\\', > 'U:\\', 'X:\\', 'Y:\\', 'Z:\\', ''] > > Christian
Yeah, I noticed that. I just thought that was a weird piece of info for the call to return. Mike -- http://mail.python.org/mailman/listinfo/python-list