把列表换成JSON格式,并根据键取值
def get_all(content, keyword):
keys = []
values = []
for specs in keyword:
num = keyword.index(specs)
keys.append(specs)
if num <= len(keyword) - 2:
values.append(keyword[num + 1])
else:
pass
spec_data = dict(zip(keys, values))
if content in spec_data:
brand = ''.join(spec_data[f'{content}']).replace(f'{content}', '')
else:
brand = '暂无'
return brand