Note that there are some explanatory texts on larger screens.

plurals
  1. POextracting values from list of tuples (in this case just one tuple in the list)
    primarykey
    data
    text
    <p>I'm working in python GAE.</p> <p>Can't figure out why I can't extract values from my tuple using <code>[index]</code>. From the logs, I can see that I do have a value in my <code>leveloneAdd</code> variable e.g. (<code>'english'</code>, <code>'subject'</code>) - but then when I'm looping through my tuple of 1, I'm getting empty in my variable <code>tag</code> and <code>htype</code> - when I'm expecting the <code>tag = 'english'</code> and the <code>htype = 'subject'</code>.</p> <p>Anyone have any thoughts?</p> <pre><code>for each in leveloneAdd: tag = each[0] htype = each[1] q1 = Level_1_Headings.all().filter("name1 =",tag).filter("heading_type =",htype).get() </code></pre> <p>So I did the repr in the logs as Martijn suggested and here are my logs: thanks for all your input! love this board - here are my logs using suggestion from Martijn --- I think it is interpreting the whole thing like a string --- </p> <pre><code>INFO 2013-01-14 19:28:17,030 main.py:291] each is ('math', 'subject') INFO 2013-01-14 19:28:17,030 main.py:292] u"('math', 'subject')" INFO 2013-01-14 19:28:17,030 main.py:294] tag is ( INFO 2013-01-14 19:28:17,030 main.py:296] heading type is ' </code></pre> <p>It looks like the string is being viewed as a string? How do I convert this to reading as a true tuple. Here is my original code where the tuple was supposed to be created (it then goes to client and then back as this as shown in the log.)</p> <p>for x in h1: listone.append((str(x.name1),str(x.heading_type)))</p> <p>The values above are in an input select drop box form AND then from server side python - i get the values by<br> leveloneAdd = (self.request.get_all("list_uno[]"))</p> <p>Sorry if these seem basic questions, I'm a beginner trying to get better!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload