Для Linux как насчет парсинга /etc/mtab
или /proc/mounts
?Или:
import commands
mount = commands.getoutput('mount -v')
lines = mount.split('\n')
points = map(lambda line: line.split()[2], lines)
print points
Для Windows я нашел что-то вроде этого:
import string
from ctypes import windll
def get_drives():
drives = []
bitmask = windll.kernel32.GetLogicalDrives()
for letter in string.uppercase:
if bitmask & 1:
drives.append(letter)
bitmask >>= 1
return drives
if __name__ == '__main__':
print get_drives()
и это:
from win32com.client import Dispatch
fso = Dispatch('scripting.filesystemobject')
for i in fso.Drives :
print i
Попробуйте, может быть, они помогут.
Также это должно помочь: Есть ли способ перечислить все доступные буквы дисков в python?