The split should work fine if you remove the r (raw string) prefix. >>> win32api.GetLogicalDriveStrings().split('\\\x00') ['A:', 'C:', 'D:', 'E:', 'F:', 'G:', 'H:', 'J:', 'K:', 'Y:', 'Z:', '']
Roger "Lucas Machado" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Roger Upole wrote: >> You could use win32api.GetLogicalDriveStrings to list >> the drive letters currently in use, and find the next free >> letter. net use * probably does something like that under >> the covers. > > I went and took your advice and this is where I am now: > >>>> import win32api >>>> a = win32api.GetLogicalDriveStrings() >>>> a > 'A:\\\x00C:\\\x00D:\\\x00E:\\\x00Z:\\\x00' >>>> print a > A:\ C:\ D:\ E:\ Z:\ > > So I think this function will work great since it gives me a string > that i can simply strip away what i don't need and then split it into a > list and traverse the list. However, when I try to split it, the > following occurs: > >>>> b = a.strip(r'\\\x00') >>>> b > 'A:\\\x00C:\\\x00D:\\\x00E:\\\x00Z:\\\x00' >>>> b = a.split(r'\\\x00') >>>> b > ['A:\\\x00C:\\\x00D:\\\x00E:\\\x00Z:\\\x00'] > > I'm a bit of a novice at python (even more so of the win32 api), but > I've used the split and strip functions before (for example to get rid > of '\n' from strings) so it is unclear to me why this does not work. > > Thanks > --LM > ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- -- http://mail.python.org/mailman/listinfo/python-list