I currently use this code to extract the required GPU data. Can you review this method for efficiency or best coding practices?
Code
import wmi c = wmi.WMI() def gpu_check(): gpu_ouy =["fu","7"] gpu_a ="" gpu_b ="" ass = str(c.Win32_VideoController()[0]) asss = str(c.Win32_VideoController()[1]) aq = ass.split() for x in range(len(c.Win32_VideoController())): ass = str(c.Win32_VideoController()[x]) saa = ass.split() saa.remove("instance") saa.remove("of") saa.remove("Win32_VideoController") saa.remove("{") saa.remove("AdapterCompatibility") saa.remove("AdapterDACType") while "=" in saa: saa.remove("=") saa.remove("};") saa.remove("SystemName") saa.remove("Description") saa.remove("InstalledDisplayDrivers") saa.remove("DeviceID") saa.remove("DriverDate") saa.remove("Name") saa.remove("Status") saa.remove("Caption") saa.remove("InfFilename") saa.remove("ConfigManagerUserConfig") saa.remove("ConfigManagerErrorCode") saa.remove("InfSection") saa.remove("DriverVersion") if "CurrentScanMode" in saa: saa.remove("CurrentScanMode") saa.remove("SystemCreationClassName") saa.remove("CreationClassName") if "CurrentRefreshRate" in saa: saa.remove("CurrentRefreshRate") if "CurrentHorizontalResolution" in saa: saa.remove("CurrentHorizontalResolution") if "CurrentVerticalResolution" in saa: saa.remove("CurrentVerticalResolution") if "CurrentNumberOfColors" in saa: saa.remove("CurrentNumberOfColors") if "MinRefreshRate" in saa: saa.remove("MinRefreshRate") if 'colors";' in saa: saa.remove('colors";') if "CurrentBitsPerPixel" in saa: saa.remove("CurrentBitsPerPixel") if "MaxRefreshRate" in saa: saa.remove("MaxRefreshRate") saa.remove("VideoProcessor") saa.remove("PNPDeviceID") if "CurrentNumberOfColumns" in saa: saa.remove("CurrentNumberOfColumns") if "CurrentNumberOfRows" in saa: saa.remove("CurrentNumberOfRows") saa.remove("Monochrome") saa.remove("Availability") del saa[5] if '"Integrated' in saa: saa.remove('"Integrated') if '"Internal";' in saa: saa.remove('"Internal";') if 'VideoModeDescription' in saa: saa.remove('VideoModeDescription') saa.remove('AdapterRAM') if 'RAMDAC";' in saa: saa.remove('RAMDAC";') sqa =int(((int(str(saa[1]).replace(";",""))/1024)/1024)/1000) saa[1] = sqa else: sqa =int(((int(str(saa[2]).replace(";",""))/1024)/1024)/1000) saa[2] = sqa if 'Corporation";' in saa: saa.remove('Corporation";') while "FALSE;" in saa: saa.remove("FALSE;") gpu_a ="" gpu_b ="" if saa[6] =="0;": gpu_a = str(saa[2]).replace('"',"")+" "+saa[3]+" "+saa[4]+" "+str(saa[5]).replace('";',"")+" "+str(saa[1])+" GB" gpu_ouy[0] = str(gpu_a) else: gpu_b = str(saa[2]).replace('"',"")+" "+saa[3]+" "+saa[4]+" "+str(saa[5]).replace('";',"")+" "+str(saa[6]).replace('";',"")+" "+str(saa[1])+" GB" gpu_ouy[1] = gpu_b return gpu_ouy
c? Isc.Win32_VideoController()a simple accessor? \$\endgroup\$assis a very bad variable name. \$\endgroup\$ass.split()is an even worse statement. \$\endgroup\$...ass\$\endgroup\$