From c04901c498370910388e5bfb3e2a1dbe98e2fdfb Mon Sep 17 00:00:00 2001 From: Vibhuti Kanitkar Date: Wed, 25 Oct 2017 10:30:39 -0400 Subject: [PATCH] this is just to test --- nested_data_answers.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/nested_data_answers.py b/nested_data_answers.py index c334d05..bad2ec4 100644 --- a/nested_data_answers.py +++ b/nested_data_answers.py @@ -1,6 +1,6 @@ # Import twitter_data.py in twitter_data in the current script # - Note the file name does not include the extension ('.py') -# - The * is a wildcard. It's telling python I want to import +# - The * is a wildcard. It's telling python I want to import # everything from the file twitter_data.py from twitter_data import * # What is the difference between the above statement and the following: @@ -31,25 +31,25 @@ # If it's a dictionary, what are its keys? -# If it's a list, how many elements does it have?, and +# If it's a list, how many elements does it have?, and # what is the type of its first element? # ---------------------------------------------------------- #print res.keys() -#print type(res['statuses']) +#print type(res['statuses']) -# Why the key "search_metadata" is not relevant +# Why the key "search_metadata" is not relevant # to our purposes? # ---------------------------------------------------------- # What is the type associated to the key 'statuses'? # ---------------------------------------------------------- -#print type(res['statuses']) +#print type(res['statuses']) # If it's a dictionary, what type are its keys? -# If it's a list, how many elements does it have?, and +# If it's a list, how many elements does it have?, and # what is the type of its first element? # ---------------------------------------------------------- #print len(res['statuses']) # 3 elements @@ -62,15 +62,15 @@ # print type(res['statuses'][i]) -# If it's the first element its a dictionary, +# If it's the first element its a dictionary, # what are its keys? -# If it's a list, how many elements does it have?, and +# If it's a list, how many elements does it have?, and # what is the type of its first element? # ---------------------------------------------------------- # print res['statuses'][0].keys() # print type(res['statuses'][0].keys()[0]) -# If it's a dictionary, how many keys does +# If it's a dictionary, how many keys does # the first dictionary have? # ---------------------------------------------------------- #print len(res['statuses'][0].keys()) @@ -84,7 +84,7 @@ # print len(res['statuses'][i].keys()) -# Nested under 'statuses', there are dictionaries, +# Nested under 'statuses', there are dictionaries, # do they have a key that contains the username I am looking for? # If so, what is the type and value associated to it? # ---------------------------------------------------------- @@ -106,17 +106,18 @@ # associated to it? # ---------------------------------------------------------- # 'name' -#print type(res['statuses'][0]['user']['name']) +#print type(res['statuses'][0]['user']['name']) #print res['statuses'][0]['user']['name'] # Since you know there are three tweets in the database # You also know there is an equal number of usernames # corresponding to the users who twitted -# By answerin the questions above, you have already found +# By answerin the questions above, you have already found # the first name -# Can you iterate through the twitter data, so that you +# Can you iterate through the twitter data, so that you # access the other three names with a single print statement? # ---------------------------------------------------------- #for i in range(len(res['statuses'])): # print res['statuses'][i]['user']['name'] +print ("testing to see what this does")