[Source] Get list of drives in Windows 04-10-2015, 12:38 PM
#1
The thread title is self-explanatory and so is the code. Nothing much to explain.
Code:
import string
from ctypes import windll
def get_drives():
drive_list = []
bitmask = windll.kernel32.GetLogicalDrives()
for letter in iter(string.letters[len(string.letters)/2:]):
if bitmask & 1:
drive_list.append(letter)
bitmask >>= 1
return drive_list
if __name__ == '__main__':
print(get_drives())![[Image: OilyCostlyEwe.gif]](http://fat.gfycat.com/OilyCostlyEwe.gif)
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)