Paste
Of Code


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
from bs4 import BeautifulSoup as BS
import re
import requests

url = "http://speccy.piriform.com/results/Gp2C5XrbHGHZhC2is2GdeA3"
response = requests.get(url)
soup = BS(response.content, "lxml-xml")

try:
    gpufind = soup.body.find("div", text='Graphics').next_sibling.next_sibling.text
    for gpuspec in re.finditer(r".*(amd|radeon|intel|integrated|nvidia|geforce|gtx).*\n.*", gpufind, re.I):
        print(gpuspec.group(0)) # <-- What I currently have to do to make ir print every match
#    What I wanted to do was:
#	gpuspec = gpuspec.group(0)
except AttributeError:
    gpuspec = None

# Then, I'd do:
# print(gpuspec)
# *if* I did what I wanted to do, I would only get the second match:
# 2047MB NVIDIA Quadro M1000M (Lenovo): 
# 42 °C

# If I do this as it currently is, it'll do it correctly:
# Intel HD Graphics 530 (Lenovo)
#
# 2047MB NVIDIA Quadro M1000M (Lenovo): 
# 42 °C
# Which, is any and all matches.

Toggle: theme, font