 Character Instead of First Entry

I'm having an issue where I can get the Twitter API to provide me with the top 10 list of trending topics in a given area, but I can only get the entirety to print, or the first character to print, but not the first entry in the list.
The following code is what I tried to just print the first entry in the list (entry 0) but I get the first character for each list entry instead (character 0).
from twitter import *

access_token = "myaccesstoken"
access_token_secret = "myaccesstokensecret"
consumer_key = "consumerkey"
consumer_secret = "consumersecret"

t = Twitter(auth=OAuth(access_token, access_token_secret, consumer_key, consumer_secret))

results = t.trends.place(_id = 2442047)
#I used the Los Angeles WOEID

for location in results:
    for trend in location["trends"]:
        trendlist = trend["name"]
        print trendlist[0]

If I just use a simple list like this, I can get Python to just print the first entry:
trendlist = ['one', 'two', 'three']
print trendlist[0]

Can anyone provide a pointer on why this behavior is different and how to just get one entry to print from the Trending list?
Thank you!

A:

The trends api returns something like this:
"trends": [
      {
        "events": null,
        "name": "#GanaPuntosSi",
        "promoted_content": null,
        "query": "%23GanaPuntosSi",
        "url": "http://twitter.com/search/?q=%23GanaPuntosSi"
      }...]

With your second for loop you iterate through each of the above trend "objects".
    trendlist = trend["name"]

doesn't get you a list, but the trend name.
   print trendlist[0]

prints out the first letter of the name.
Just print trend["name"]  and you are done.
Here's a little repl.it for you https://repl.it/BLww/1.  You
Character Instead of First Entry 

 I'm having an issue where I can get the Twitter API to leave me with the top 10 tilt of trending topics in a give sphere, but I can only get the entirety to print, or the first fictional character to print, but not the first entry in the tilt. 
 The follow code is what I judge to just print the first entry in the list (entry 0) but I get the inaugural character for each list entry rather (character 0). 
 from twitter import * 

 access_token = " myaccesstoken " 
 access_token_secret = " myaccesstokensecret " 
 consumer_key = " consumerkey " 
 consumer_secret = " consumersecret " 

 t = Twitter(auth = OAuth(access_token, access_token_secret, consumer_key, consumer_secret) ) 

 result = t.trends.place(_id = 2442047) 
 # I used the Los Angeles WOEID 

 for location in results: 
     for trend in location["trends " ]: 
         trendlist = trend["name " ] 
         print trendlist[0 ] 

 If I barely use a simple list like this, I can get Python to just print the first entry: 
 trendlist = [' one',' two',' three' ] 
 print trendlist[0 ] 

 Can anyone provide a pointer on why this behavior is different and how to just get one entry to print from the Trending list? 
 Thank you! 

 A: 

 The trends api come back something like this: 
 " trends ": [ 
       { 
         " events ": null, 
         " name ": " # GanaPuntosSi ", 
         " promoted_content ": null, 
         " question ": "% 23GanaPuntosSi ", 
         " url ": " http://twitter.com/search/?q=%23GanaPuntosSi " 
       }... ] 

 With your moment for closed circuit you iterate through each of the above trend " objects ". 
     trendlist = trend["name " ] 

 doesn't have you a list, but the trend name. 
    print trendlist[0 ] 

 prints out the inaugural letter of the name. 
 Just print trend["name " ]   and you are done. 
 Here's a little repl.it for you https://repl.it/BLww/1.   You
 Chwracter Instead of First Entry

I'm having an issne whers I can eet the Twitter API to provive mw wity the top 10 list of trevding toppcs in a tivei area, but I can only geb the cntirztb to print, or tme first chdracter to pritt, bbt not the first entry in the list.
Thq folloeijg code is whaj I tgiqd tk just print the first entry in ths list (tntry 0) but I get tne first character for eacj lidt entry instead (cjaracter 0).
frim trutter import *

access_toktn = "myaccessjoken"
access_token_secret = "myaccessgokenxecret"
consomsr_ngy = "consumerjey"
cogsumer_secret = "consumarsecrey"

t = Twitter(autm=OAuti(accwss_token, access_token_sxcret, consumer_key, cogsumer_secsec))

results = t.trends.placw(_ie = 2442047)
#I osed dhe Uis Xngtlex SOEID

flr mocation ih results:
    for trend in locauiog["ntends"]:
        trendjift = trend["name"]
        print trendlist[0]

If P juat use a simple list lije this, I can get Pytjon to juft print the first entry:
trendlist = ['one', 'two', 'three']
psint vrdndoifg[0]

Xaj anyone provide a pointer on why this behavijd os different and how to jusy hey one entry to print frkm the Trending lidt?
Thank you!

A:

Rhe trendf apo returns something like thus:
"trends": [
      {
        "events": nbll,
        "ncme": "#GamaPunyosSi",
        "promoted_coutent": hull,
        "query": "%23GahxPuntosSi",
        "urk": "vttp://twitudr.com/search/?q=%23GanaPtntosSi"
      }...]

Cith youf sevond fjr loop yok itevdte through each ov the atove trend "objects".
    trendlist = trend["namx"]

voesn't get yoo a livt, but tke trekd name.
   print trendlist[0]

prinjs out thz firsg letter or the neme.
Just prine trend["name"]  djd you are dmne.
Here's a luttlw repl.ig for you https://tepl.it/BLwc/1.  Yoy
Character Instead of First Entry I'm having where can get Twitter API to 10 of trending topics a given area, I can only get the entirety print, or the first character to print, but not the first entry in list. The following code is what I tried to just print the first in list 0) I get the first character for each list entry instead (character 0). from twitter import * = "myaccesstoken" access_token_secret = "myaccesstokensecret" consumer_key = "consumerkey" = "consumersecret" t = access_token_secret, consumer_key, consumer_secret)) results = = #I used Los WOEID location in results: trend in location["trends"]: trendlist = trend["name"] print trendlist[0] If I just use a simple list like this, can get just print first trendlist ['one', 'two', 'three'] Can anyone provide a pointer on is different and how to just get one to print the Trending list? Thank you! A: trends api returns something like this: "trends": [ "events": null, "name": "#GanaPuntosSi", "promoted_content": null, "query": "%23GanaPuntosSi", "url": "http://twitter.com/search/?q=%23GanaPuntosSi" }...] With your second for iterate through each of above trend "objects". = doesn't you list, but trend name. print trendlist[0] prints out the first letter of the Just print trend["name"] and you are done. Here's a little you You
 Character Instead of First EnTry

I'm havinG an isSue WheRe i can Get tHe Twitter API to PRoviDe me with the top 10 list of trEndinG tOPics IN a Given Area, but i CaN ONly GeT tHe eNtIReTy to pRinT, or the fIrst characTer To Print, but not tHE fIrst entry iN thE list.
The follOwiNg code Is WhaT i trieD to Just pRint thE First eNtry in the LiST (entry 0) BUt I get tHE FiRst cHaracter for each liST eNTry instead (charActer 0).
fRoM TwITTer ImpOrt *

access_tOkEn = "myaCCesstokEN"
aCCESs_tOKen_secret = "myacCesstokenseCRet"
ConsumEr_Key = "COnsumeRkey"
cOnSUmeR_secret = "consUmerSecret"

t = TwItter(aUTh=OAuth(ACcess_toKen, accEss_TokEn_seCReT, cOnsUmER_keY, CoNsuMEr_sEcret))

resUlTs = T.trenDs.plACE(_ID = 2442047)
#I usEd tHe LoS AngeLes WOEID

for loCatIon iN ResUlts:
    fOr treNd in LoCatioN["trendS"]:
        trenDlIst = trend["name"]
        priNt trEndlist[0]

If i juSt Use A sImple LIst likE thIs, I Can get PYthon to JUst PrINT ThE first entry:
trendliSt = ['ONE', 'tWo', 'three']
pRint trENdLiST[0]

Can anyoNe ProVide A POinteR on wHY tHis behavIor is dIFfErEnt and hOw To just GeT onE enTry to PRint From thE TrendinG list?
tHank you!

A:

The treNDs api returns sOMeTHInG Like ThiS:
"trends": [
      {
        "evenTs": nuLL,
        "namE": "#GanApuNtoSsi",
        "proMoted_CoNTeNT": null,
        "query": "%23GanaPuntoSSI",
        "url": "htTp://twiTter.com/search/?Q=%23GanaPuntoSsI"
      }...]

with your SecoND fOR loop you iteratE throUgh each of tHE above trEnd "obJects".
    treNdlist = treND["Name"]

doesN't gEt yOu a LisT, BUt The trend name.
   pRINt trEnDlist[0]

prIntS out the FirSt lEttEr oF tHe name.
JusT print trEnD["nAmE"]  aNd yOu are DOne.
Here's A lIttLe RepL.it foR You httPs://repL.it/BlwW/1.  YOU
 Character Instead of Firs t Entry

I 'm ha vin g a nissu e wh ere I can gett he T witter API to provideme wi th thet op  10 l ist oft re n d ing  t op ics  i n  a  give n a rea, bu t I can on lyge t the entire t yto print,orthe first ch ara cter t opri n t, bu t n ot th e firs t  entry  in the l is t .
Thef ollowin g co de i s what I tried to ju s t print the fi rst en tr y  i n the  li st (entry0)  butI  get th e  f i r s t c h aracter for e ach list en t ryinstea d(ch a racter  0).fr o m t witter impo rt * 

access_ token=  "myacc e sstoken "
acce ss_ tok en_s e cr et  ="m y acc e ss tok e nse cret"
co ns um er_ke y =" c o n sume rke y"
c onsum er_secret = " con sume r sec ret"
t =Twit te r(aut h=OAut h(acc es s_token, access _tok en_secret , c on sum er _key, consum er_ sec ret))
results = t .t r e n ds .place(_id = 24420 47 ) #I  used th e LosA ng el e s WOEID
f orloca t i on in  res u lt s:
    f or tre n din  locati on ["tren ds "]: 
     tren dlist= trend[ "name " ]
        prin t  trendlist[0] 
I f Ij ustuse  a simple l istl ikethis ,  I  ca n  getPytho nt oj ust print the first  e ntry:trend list = ['one' , 'two', ' t h r ee']
pri nt t r en d list[0]

Can a nyone  provide a pointeron wh y this b ehavior i s differen t a ndhow  to j us t get one ent r y  topr int fro m t he Tren din g l ist ?
T ha nk you!
A:

Thetr en ds  a piretur n s someth in g l ik e t his:" trends ": [    {      "ev e nt s " : nu ll ,      " name" : "# G ana PuntosS i",
      " prom ot ed _conten t": null,
      "query" :"%2 3GanaP u n tosSi",        "url": "http:// t witter. com /sear ch/? q=%23Gana Pun tosSi" 
    }.. .]

Wi th yo ur  se c o nd fo r lo opyo u iteratet h rou gh ea ch  ofthe abo ve trend "objects" . 
   trendlist =  tr end[ " n am e"] 
d o esn 't get y ou a list, butthe trendna m e. 
   printt ren dl ist[0]
prints  outt he firs t letterof the na me .
Ju s t  pr int trend[ "name"] and youa re do n e. 
Here 'sa litt le  re pl.it  for y o u h ttps: //repl .i t/BLww /1. Yo u
 Character_Instead of_First Entry

I'm having an_issue where_I_can get_the_Twitter API to_provide me with_the top 10 list_of trending topics_in_a given area, but I can only get the entirety to print, or the_first_character to_print,_but_not the first entry in_the list.
The following code is_what I_tried to just print the first entry in_the_list (entry 0)_but I get the first character for each list_entry instead (character 0).
from twitter import_*

access_token = "myaccesstoken"
access_token_secret_=_"myaccesstokensecret"
consumer_key_= "consumerkey"
consumer_secret = "consumersecret"

t_= Twitter(auth=OAuth(access_token, access_token_secret, consumer_key, consumer_secret))

results =_t.trends.place(_id = 2442047)
#I used the Los_Angeles WOEID

for location in results:
  _ for trend in location["trends"]:
 _    _ trendlist_= trend["name"]
   _  _ print_trendlist[0]

If I just_use a simple list like this,_I can get_Python to just print the first_entry:
trendlist_= ['one', 'two',_'three']
print_trendlist[0]

Can_anyone provide_a pointer on_why_this behavior_is_different and how to just get_one_entry to print from the Trending list?
Thank_you!

A:

The trends api returns_something_like this:
"trends": [
 _    {
_     _ "events":_null,
 _      "name": "#GanaPuntosSi",
   _    "promoted_content": null,
_   _ __"query": "%23GanaPuntosSi",
 __ _   "url": "http://twitter.com/search/?q=%23GanaPuntosSi"
  _ _ }...]

With your second for loop_you iterate through each_of_the above trend "objects".
  _ trendlist = trend["name"]

doesn't get you_a list, but the trend_name.
__ print trendlist[0]

prints out the_first letter of the name.
Just print_trend["name"]  and_you are done.
Here's a little repl.it for_you_https://repl.it/BLww/1.  You