Python中的字典,列表等。如何在词典中提取信息

时间:2016-04-29 20:23:05

标签: python dictionary

我正在努力提取有关入学学生性别的信息。我的目标是比较女性和男性。

This is some of the data

import matplotlib.pyplot as plt
import education
list_of_record = education.get_all_states ()
virginia_education = education.get_state ('Virginia')
enrollment = list_of_record ['enrollment']

我试过了,但它没有用。它给了我" TypeError:列表索引必须是整数或切片,而不是str"

if enrollment in virginia_education:
    female = enrollment ['gender']

0 个答案:

没有答案