Linux의 경우 구문 분석 방법은 /etc/mtab
또는 /proc/mounts
입니까? 또는 : 어쩌면 그들은 도움
from win32com.client import Dispatch
fso = Dispatch('scripting.filesystemobject')
for i in fso.Drives :
print i
그 시도 :
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()
이 : Windows의 경우
import commands
mount = commands.getoutput('mount -v')
lines = mount.split('\n')
points = map(lambda line: line.split()[2], lines)
print points
나는 이런 식으로 뭔가를 발견했다.
또한 도움이됩니다. Is there a way to list all the available drive letters in python?