lundi 10 octobre 2016

How to select only 3 item randomly from a list of dictionaries

this is giving all the "YES" layers from the list with open ("soccer_playerss.csv", newline='')as csvfile: player_read = csv.DictReader(csvfile, delimiter =',') player_list = list(player_read) print(player_list)

Dragons =[]

player = " "
#this is where I am facing the problem
def team_division(player):
    for player in player_list:
        if player['Soccer Experience'] == "YES":
            Dragons.append(player)
    print ("DRAGONS: ",Dragons)




Aucun commentaire:

Enregistrer un commentaire