Question: Reading and parsing YAML files I know you do not have the file I just need the code, thank you! 1. Open file charlotte_hornets.yaml -

Reading and parsing YAML files

I know you do not have the file I just need the code, thank you!

1. Open file charlotte_hornets.yaml - NOTE: Use with open(...) as XXXXX: to eliminate having to close() the file. 2. Use yaml.load() with Loader=yaml.FullLoader to read file charlotte_hornets.yaml into a variable named charlotte_hornets.

Start "drilling" down into the various levels of charlotte_hornets_dict ... 3. Create a dictionary named hornets_dict containing the values using KEY = hornets -- NOTE: You should be referencing the charlotte_hornets_dict

Now "drill" down another level to get the players LIST ... using hornets_dict from previous step. 4. Create a Python LIST named players_list containing the values using KEY = players

Now create a new LIST to collect the player data (rank,name,pos,ppg) -- one entry per player ... 5. Create a Python LIST named player_data using the following formatting: - 5a. Each entry in the list should contain the values for keys = 'rank', 'name', 'pos' and 'ppg' - 5b. Concatenate the values to create a single STRING with values separated by a SPACE COLON SPACE (' : ') - HINT: Use a FOR-loop to process each entry in players_list

Each list entry should look like: 1 : LaMelo Ball : PG : 23.3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!