<div id="RTEContent">Thank you sir!<br> Sorry, I am very new to python.&nbsp; It's quite unlike other languages.<br> <br> Happy new year!<br> Al<br><br><b><i>David H &lt;bluepaul@earthlink.net&gt;</i></b> wrote:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;">      <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">  Alric Aneron wrote: <blockquote cite="mid20051230173208.49590.qmail@web50210.mail.yahoo.com" type="cite">hello,<br> I have a python code that recieves two result objects from two different ZSQL methods.&nbsp; I need to join them (sort of like UNION).<br> I can't do result1+result2, otherwise it raises an exception that the + operator isn't supported.<br> When I try to do this (read below, I explained what i've done if you are lazy to read the code)<br> result1 = context.zsqlmethod1()<br> result2 = context.zsqlmethod2()<br> if (len(result1) == 0):<br> &nbsp;&nbsp;&nbsp; return result2<br>
 row1 = 0<br> row2 = len(result1) + 1<br> col = 0<br> for r in result2:<br> &nbsp;&nbsp; col = 0<br> &nbsp;&nbsp; if (context.duplicateExists(result1, result2[row1][0]) == -1):<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result1[row2][col] = result2[row][col]<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; col = col + 1<br> &nbsp;&nbsp; row1 = row1 + 1<br> &nbsp;&nbsp; row2 = row2 + 1<br>   <br> return result1<br>   <br> Basically, it loops through the rows and columns of result2 and adds them to the end of th e result 1.&nbsp; However it for some reason raises "index out of range" and says that assigning result1[0][0]=result2[0][0] (if there is an element in both of them) is illegal because:<br>   <strong>Error Value: object does not support item or slice assignment<br>   </strong>I realize that in most programming languages you can't add them to result1 without resizing it first, but I can't find much documentaiton on member functions of the result object, so I can't resize it.&nbsp; <br> I
 am completely stuck, I've tried everything, spent so much time on it, can anyone please help save my sanity :P<br>   <br> Thanks in advance guys! I really appreciate it.<br>   <div> </div>   <hr size="1"> <a href="http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=37474/*http://promo.yahoo.com/broadband/%20">Y</a></blockquote> Alric,<br> The merging of two zsql result sets is easy - here's one way:<br> newResults = []<br> <br> for r in resultset1:<br> &nbsp; newResults.append( r )<br> <br> for r in resultset2:<br> &nbsp; newResults.append( r )<br> <br> return newResults.<br> <br> David<br> <br> <br> <br> <br> <br> </blockquote><br></div><p>
                <hr size=1>Yahoo! Photos<br> 
Ring in the New Year with <a href="http://us.rd.yahoo.com/mail_us/taglines/photos/*http://pg.photos.yahoo.com/ph//page?.file=calendar_splash.html&.dir=">Photo Calendars</a>. Add photos, events, holidays, whatever.