我有一个包含 2 个项目列表的列表,如下所示:
list_of_parsed_rows =
[['ADP:', 'Round: 1, Pick: 2'],
['Team:', 'Carolina Panthers'],
['Ht / Wt:', '5\'11" / 202 lb.'],
['College:', 'Stanford'],
['Age:', '24'],
['Born:', 'June 7, 1996'],
['Drafted:', '2017 /\n\nRd. 1 (8)'],
['Draft Team:', 'CAR'],
['Saquon Barkley', 'RB', 'NYG', '1.02'],
['Ezekiel Elliott', 'RB', 'DAL', '1.04'],
['Derrick Henry', 'RB', 'TEN', '1.04'],
['Dalvin Cook', 'RB', 'MIN', '1.05'],
['Alvin Kamara', 'RB', 'NO', '1.06'],
['Michael Thomas', 'WR', 'NO', '1.08'],
['Josh Jacobs', 'RB', 'LV', '1.08'],
['Nick Chubb', 'RB', 'CLE', '1.09'],
['Aaron Jones', 'RB', 'GB', '1.10'],
['Tyreek Hill', 'WR', 'KC', '1.11'],
['Joe Mixon', 'RB', 'CIN', '1.11'],
['Pat Mahomes', 'QB', 'KC', '2.01'],
['Davante Adams', 'WR', 'GB', '2.01'],
['DeAndre Hopkins', 'WR', 'ARI', '2.02'],
['Miles Sanders', 'RB', 'PHI', '2.03']]
我正试图用以下内容将它变成一个字典
dict_of_parsed_rows = {key: value for key, value in list_of_parsed_rows}
但我收到以下错误消息:
ValueError: too many values to unpack (expected 2)
知道发生了什么吗?奇怪的是,这是一本书中问题的确切解决方案,我很惊讶它是不正确的。
烙印99
一只斗牛犬
忽然笑
眼眸繁星
相关分类