[google-appengine] Re: Can I use set in Appengine?
Hi If your using Python 2.5 then you need to import the sets module. >>> from sets import Set >>> Set([1,2,1,2,4]) Set([1, 2, 4]) >>> This code will also work in 2.7 Though in 2.7 you have the set type builtin. Rgds Tim -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/jbZddnsDuQgJ. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: Can I use set in Appengine?
It's not working for me. The code: from sets import Set (..) Set(tweetlist) tweetlist.sort() print tweetlist The results: [u'1001storieRoma', u'3zoOozq8', u'6PierC9', u'ABelal10', u'ASRoma_1927', u'ASRoma_1927', u'ASRoma_1927', u'AcoSoegono', u'AdiCuur', u'AdistaAdinda', u'AleSCCP', u'Alpax93', u'AndreaGirvasi', u'AndreaGirvasi', u'AndreaLaureti', u'AngeloMarolla', u'AnnameryZA', u'Aquismaia21', u'Arianthorn', u'ArsAas', u'Assemotti', u'Baressobastia', u'Barz_O', u'Beamikyb', u'BhargaWisnawa', u'BoDherar', u'BonHakkinen', u'BrickView', u'Budicesc', u'BuonAndrew', u'Burziga', u'C4224', u'CalcioBlogLive', u'CalcioBlogLive', u'CamillaSpinelli', u'CarlaTrudu', u'ChenguGold', u'Cicciotosto', u'ClaudiaBorry', u'DanyRecchia', u'Darko_8_', u'Darko_8_', u'DaveSaveriano', u'Davide_Martelli', u'Davide_Martelli', u'Dborruto', u'DeadCatDeadRat', u'DemonBrando', u'DemonBrando', u'DiSalviaMichele', u'Di_Elle', u'Di_Elle', u'Di_Elle', u'Di_Elle', u'Di_Elle', u'Di_Elle', u'Di_Elle', u'Di_Elle', u'Di_Elle', u'Di_Elle', u'Di_Elle', u'Di_Elle', u'Di_Elle', u'DianaDionisioG', u'DjSekou', u'EmDeFra', u'EmanueleMelfi', u'Er_capo5', u'ErikCocoTomo', u'Erik_lamela_', u'FeDeShh', u'FedeFede_', u'FedericaLago', u'Ferdinando_R', u'Filver93', u'FiqiAinur', u'Fra__Asr', u'Francesca_LG', u'Frau87', u'Frau87', u'Frau87', u'Frau87', u'FunkyKovael', u'GIOVANNI_N0', u'Gabriella_Guida', u'Giaima', u'Giugia89', u'Giulia_B34', u'Giulia__asr', u'Giulia__asr', u'Giuseppecaboni', u'GregMY', u'GretaFaccani', u'Gsateeh', u'Hamod_D', u'Hellii4', u'HudsonKnedyGirl', u'Ilya_Kam', u'Irishtotti', u'Itz_Simple', u'Itz_Simple', u'J_Stonebraker', u'J_Stonebraker', u'Jack_Bauer1978', u'Jack_Bauer1978', u'JuJuAlmal', u'JuJuAlmal', u'JuJuAlmal', u'Kayingi', u'LAROMA24', u'LAROMA24', u'LAROMA24', u'LAROMA24', u'LAROMA24', u'LUTP', u'LUTP', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRom
[google-appengine] Re: Can I use set in Appengine?
http://shell.appspot.com/ >>> set([1,2,3,4,5,1,2]) set([1, 2, 3, 4, 5]) -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: Can I use set in Appengine?
Unlike sort(), sorted() doesn't sort in place, but returns the result. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: Can I use set in Appengine?
Thanks, your post is really great. After reading it I solve like this: tweetlist = sorted(set(tweetlist)) Really thanks! -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/bSm9J2z-PNoJ. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
Re: [google-appengine] Re: Can I use set in Appengine?
>From http://docs.python.org/library/stdtypes.html#set-types-set-frozenset: "A set object is an unordered collection" You can use set() to filter out duplicates. But then you need to convert back to a list to be able to sort: result = sorted(list(set(tweetlist))) On Mon, Nov 14, 2011 at 2:22 PM, pdknsk wrote: > http://shell.appspot.com/ > set([1,2,3,4,5,1,2]) > set([1, 2, 3, 4, 5]) > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to google-appengine@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
Re: [google-appengine] Re: Can I use set in Appengine?
To improve my previous post: no need to use list(). You can do sorted(set(tweetlist)). On Mon, Nov 14, 2011 at 2:29 PM, Matt Jibson wrote: > From http://docs.python.org/library/stdtypes.html#set-types-set-frozenset: > "A set object is an unordered collection" > > You can use set() to filter out duplicates. But then you need to > convert back to a list to be able to sort: > result = sorted(list(set(tweetlist))) > > On Mon, Nov 14, 2011 at 2:22 PM, pdknsk wrote: >> http://shell.appspot.com/ >> > set([1,2,3,4,5,1,2]) >> set([1, 2, 3, 4, 5]) >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google App Engine" group. >> To post to this group, send email to google-appengine@googlegroups.com. >> To unsubscribe from this group, send email to >> google-appengine+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/google-appengine?hl=en. >> >> > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
Re: [google-appengine] Re: Can I use set in Appengine?
You don't need to import Sets in Python 2.5. -Nick On Tue, Nov 15, 2011 at 2:51 AM, Tim Hoffman wrote: > Hi > > If your using Python 2.5 then you need to import the sets module. > > >>> from sets import Set > >>> Set([1,2,1,2,4]) > Set([1, 2, 4]) > >>> > > This code will also work in 2.7 > > Though in 2.7 you have the set type builtin. > > Rgds > > Tim > > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-appengine/-/jbZddnsDuQgJ. > > To post to this group, send email to google-appengine@googlegroups.com. > To unsubscribe from this group, send email to > google-appengine+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > -- Nick Johnson, Developer Programs Engineer, App Engine -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
Re: [google-appengine] Re: Can I use set in Appengine?
I don't know, but still not working. (I'm working in coderbuddy.com). This my code: class MainHandler(webapp.RequestHandler): def get(self): tweetlist=[] appo=[] for i in range(1, 16): public_tweets = tweepy.api.search(q='#asroma', rpp=100, lang='it', show_user='true', page=i) for tweet in public_tweets: appo = tweet.text.split(':') tweetlist.append(appo[0]) sorted(set(tweetlist)) print tweetlist This is the result: [u'SaryLittleBovix', u'romacalcionews', u'romacalcionews', u'romacalcionews', u'alexszeuzstfau', u'romacalcionews', u'romacalcionews', u'asroma_club', u'asroma_club', u'asroma_club', u'cahyoJUVE', u'RomaIndoPLG', u'xilovebojan_asr', u'r0by', u'Roma182', u'denni1327', u'romacalcionews', u'Tomjoad71', u'laromanet', u'giuseppex1', u'betman', u'Di_Elle', u'romacalcionews', u'mashirado', u'mashirado', u'mashirado', u'Davide_Martelli', u'mashirado', u'romacalcionews', u'alexszeuzstfau', u'AntonFilippo', u'giallorossa4', u'romacalcionews', u'giallorossa4', u'domenicocamusi', u'giallorossa4', u'laromanet', u'romacalcionews', u'RobertoRenga', u'mashirado', u'dick7folds', u'romacalcionews', u'MarcoFattorini', u'adheto', u'denni1327', u'romacalcionews', u'tuttocalcio', u'Xavikevicius', u'xHelliiGlastle', u'Santupea', u'OfficialASRoma', u'xpennyecioffy', u'romacalcionews', u'romacalcionews', u'romacalcionews', u'eijan31', u'RoMaNiSta_8', u'laromanet', u'romacalcionews', u'xemotionalrain_', u'xdeeni', u'Watz0n', u'giallorossa4', u'tsumio4', u'Di_Elle', u'MikeArvanitis18', u'juliantama77', u'AdistaAdinda', u'ramamor21', u'xpennyecioffy', u'adheto', u'OfficialASRoma', u'vale_soulkeys', u'romacalcionews', u'1001storieRoma', u'FeDeShh', u'romacalcionews', u'giallorossa4', u'Loris41086', u'romacalcionews', u'giallorossa4', u'AndreaGirvasi', u'giallorossa4', u'romacalcionews', u'sayheyyrene', u'romacalcionews', u'OfficialASRoma', u'ipincescototti', u'romacalcionews', u'CalcioBlogLive', u'romacalcionews', u'SwOmar', u'SwOmar', u'SwOmar', u'SwOmar', u'SwOmar', u'SwOmar', u'SwOmar', u'silvicone', u'romacalcionews', u'romacalcionews', u'Gabriella_Guida', u'romacalcionews', u'romacalcionews', u'whatalex', u'romacalcionews', u'romacalcionews', u'romacalcionews', u'romacalcionews', u'illupified', u'illupified', u'Giuseppecaboni', u'romacalcionews', u'RobertoRenga', u'romacalcionews', u'asroma_club', u'DjSekou', u'romacalcionews', u'romacalcionews', u'giallorossa4', u'romacalcionews', u'xshelovesjulio', u'directioner_asr', u'romacalcionews', u'giallorossa4', u'romacalcionews', u'romacalcionews', u'laromanet', u'romacalcionews', u'OfficialASRoma', u'romacalcionews', u'_Axeelle', u'romacalcionews', u'LaRomaSiamoNoi', u'massimilianom29', u'AndreaLaureti', u'romacalcionews', u'FunkyKovael', u'tuttocalcio', u'Ilya_Kam', u'romacalcionews', u'almostbelgian', u'AleSCCP', u'marquesrequian', u'helmputih', u'giallorossa4', u'_Axeelle', u'giallorossa4', u'LaRomaSiamoNoi', u'weiloume', u'romacalcionews', u'Loris41086', u'RickWeggemans', u'antonio__romano', u'RomanistiPLK', u'RomanistiPLK', u'letsbefreaks19', u'XlukmanX', u'elhasym', u'LUTP', u'romaindonesia', u'sandyrobot', u'crilenny', u'fikryobama', u'ivanhawk', u'thrasher93x', u'brucebanter', u'BhargaWisnawa', u'ramamor21', u'yoga_nasu', u'DemonBrando', u'Thebigswords', u'hdwibowo', u'Beamikyb', u'AnnameryZA', u'Di_Elle', u'FiqiAinur', u'heylanaguedes', u'Dborruto', u'OfficialASRoma', u'LaRomaSiamoNoi', u'romacalcionews', u'shapiro87', u'ipincescototti', u'solzinho_', u'solzinho_', u'romacalcionews', u'illupified', u'LaRomaSiamoNoi', u'romacalcionews', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'benjamin631', u'romacalcionews', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'LaRomaSiamoNoi', u'romacalcionews', u'alexszeuzstfau', u'romacalcionews', u'romacalcionews', u'romacalcionews', u'pucciarellic', u'BuonAndrew', u'mirkomeci', u'thedice79', u'Rosilde', u'Davide_Martelli', u'macbroccoli', u'carlomatt', u'StuartJHarper', u'Di_Elle', u'Di_Elle', u'MichiMartino', u'fabvalenza', u'giallorossa4', u'giallorossa4', u'tuttocalcio', u'romacalcionews', u'giallorossa4', u'tuttocalcio', u'Barz_O', u'romacalcionews', u'Roma182', u'LaRomaSiamoNoi', u'romacalcionews', u'laromanet', u'solo4roma', u'solo4roma', u'laromanet', u'solo4roma', u'romacalcionews', u'asroma_club', u'asroma_club', u'fabbbio80', u'elhasym', u'LaRomaSiamoNoi', u'romacalcionews', u'romacalcionews', u'OfficialASRoma', u'romacalcionews', u'PagineRomaniste', u'giallorossa4', u'PagineRomaniste', u'romacalcionews', u'romacalcionews', u'pucciarellic', u'pucciarellic', u'itsflo_', u'francy_asr', u'pucciarellic', u'tuttocalcio', u'CalcioBlogLive', u'romacalcionews', u'laromanet', u'giallorossa4', u'romacalcionews', u'giallorossa4', u'giallorossa4', u'OfficialASRoma', u'romacalcionews', u'giallorossa4', u'laromanet', u'SwOmar', u'SwOmar', u'