Win32 drive mapping... aka "net use"
rupole at hotmail.com
Sat Mar 5 21:07:24 CET 2005
The split should work fine if you remove the r
(raw string) prefix.
['A:', 'C:', 'D:', 'E:', 'F:', 'G:', 'H:', 'J:', 'K:', 'Y:', 'Z:', '']
"Lucas Machado" <LMachado1 at gmail.com> wrote in message
news:1110051935.541036.146070 at z14g2000cwz.googlegroups.com...
> 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()
>>>> 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.split(r'\\\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.
----== 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 =----
More information about the Python-list