I have python code that can list all drive letters but now I need also list the name of drive letter (Label) and the size of hard drive like below!
Ltr Label Size ---- ------ --------- C Windows 800 GB E Local Disk 200 GB F My Passport 500 GB Y Secret 1 GB import string from ctypes import windll def get_drives(): drives =  bitmask = windll.kernel32.GetLogicalDrives() for letter in string.ascii_uppercase: if bitmask & 1: drives.append(letter) bitmask >>= 1 return drives if __name__ == '__main__': print (get_drives()) # On my PC, this prints ['A', 'C', 'D', 'F', 'H']
OR This code
import os print (os.popen("fsutil fsinfo drives").readlines())
How can I do it ?
I appreciate your help really