是否可以使用打字稿或JavaScript进行分组? 例如,我有这个对象数组
from urllib.request import Request, urlopen
from bs4 import BeautifulSoup
page = "https://www.bureauxlocaux.com/recherche/?transaction_type=sale&realty_type=office&page=1"
req = Request(page, headers={'User-Agent': 'Mozilla/5.0'})
web_byte = urlopen(req).read()
webpage = web_byte.decode('utf-8')
bs = BeautifulSoup(webpage, 'html.parser')
announces = bs.findAll('li',{'class':'item-card'})
所以,这就是我现在所拥有的。具有多个值和相同名称的对象数组。我需要使用相同的名称对值进行分组。像这样:
let clases = [
{name: 'Math',grade: 83},
{name: 'Math',grade: 36},
{name: 'Math',grade: 20},
{name: 'Programing',grade: 100},
{name: 'Programing',grade: 55},
{name: 'Programing',grade: 13},
{name: 'Programing',grade: 90},
{name: 'Art',grade: 98},
{name: 'PE',grade: 93},
{name: 'English',grade: 42},
{name: 'Bio',grade: 60}
];
谢谢