Oct-13-2019, 07:09 PM
Hello everyone,
My classmate and I are doing a homework and we need help (cause we are NOT familiar at all with coding)
In brief, we're trying to extract users' location using API and isolate those from the States. (We already have a list with all locations, but we only want USA' locations from this list)
The idea is to compilate users from each states and make a graph out of it.
The problem is that we are not able to dress the list with only USA locations. Look at what we have done so far:
for le_tweet in searched_tweets:
print(le_tweet.user.location)
**the list appears**
Now we only want USA locations:
liste_localisation = le_tweet.user.location
liste_usa = ["'AL' or 'AK' or 'AZ' or 'AR' or 'CA' or 'CO' or 'CT' or 'DE' or 'FL' or 'GA' or 'HI' or 'ID' or 'IL' or 'IN' or 'IA' or 'KS' or 'KY' or 'LA' or 'ME' or 'MD' or 'MA' or 'MI' or 'MN' or 'MS' or 'MO' or 'MT' or 'NE' or 'NV' or 'NH' or 'NJ' or 'NM' or 'NY' or 'NC' or 'ND' or 'OH' or 'OK' or 'OR' or 'PA' or 'RI' or 'SC' or 'SD' or 'TN' or 'TX' or 'UT' or 'VT' or 'VA' or 'WA' or 'WV' or 'WI' or 'WY'"]
for tweet_usa in liste_localisation:
if tweet_usa == liste_usa:
print(tweet_usa)
***************************************
We are stuck here.
Can someone help 2 rookies
My classmate and I are doing a homework and we need help (cause we are NOT familiar at all with coding)
In brief, we're trying to extract users' location using API and isolate those from the States. (We already have a list with all locations, but we only want USA' locations from this list)
The idea is to compilate users from each states and make a graph out of it.
The problem is that we are not able to dress the list with only USA locations. Look at what we have done so far:
for le_tweet in searched_tweets:
print(le_tweet.user.location)
**the list appears**
Now we only want USA locations:
liste_localisation = le_tweet.user.location
liste_usa = ["'AL' or 'AK' or 'AZ' or 'AR' or 'CA' or 'CO' or 'CT' or 'DE' or 'FL' or 'GA' or 'HI' or 'ID' or 'IL' or 'IN' or 'IA' or 'KS' or 'KY' or 'LA' or 'ME' or 'MD' or 'MA' or 'MI' or 'MN' or 'MS' or 'MO' or 'MT' or 'NE' or 'NV' or 'NH' or 'NJ' or 'NM' or 'NY' or 'NC' or 'ND' or 'OH' or 'OK' or 'OR' or 'PA' or 'RI' or 'SC' or 'SD' or 'TN' or 'TX' or 'UT' or 'VT' or 'VA' or 'WA' or 'WV' or 'WI' or 'WY'"]
for tweet_usa in liste_localisation:
if tweet_usa == liste_usa:
print(tweet_usa)
***************************************
We are stuck here.
Can someone help 2 rookies
