Hello. Please see the code below: > <table> > $for r in xrange(31): > <tr> > $for c in xrange(31): > <td> > $if r == 0 and c == 0: $pass > $elif r == 0: $goesc[c-1].name > $elif c == 0: $goesr[r-1].gou > $else: > $if r == c: > <input type="text" id="r$(r)c$(c)" name="r$(r)c$(c)" > class="text same" placeholder='$r->$c' value="$nicks['r1c1']" /> > $else: > <input type="text" id="r$(r)c$(c)" name="r$(r)c$(c)" > class="text" placeholder='$r->$c' value="$nicks['r1c1']" /> > </td> > </tr> > </table>
Look at the variable named "nicks". It's a dictionary those keys are from "r1c1" to "r30c30". I want to write like this, but it shows error. $nicks['r$(r)c$(c)'] How can I write sequential keys of a dictionary or do I have to write like this? <td><input type="text" id="r$(r)c$(c)" name="r$(r)c$(c)" > class="text same" placeholder='$r->$c' value="$nicks['r1c1']" /></td> > <td><input type="text" id="r$(r)c$(c)" name="r$(r)c$(c)" > class="text same" placeholder='$r->$c' value="$nicks['r1c2']" /></td> > <td><input type="text" id="r$(r)c$(c)" name="r$(r)c$(c)" > class="text same" placeholder='$r->$c' value="$nicks['r1c3']" /></td> > <td><input type="text" id="r$(r)c$(c)" name="r$(r)c$(c)" > class="text same" placeholder='$r->$c' value="$nicks['r1c4']" /></td> > <td><input type="text" id="r$(r)c$(c)" name="r$(r)c$(c)" > class="text same" placeholder='$r->$c' value="$nicks['r1c5']" /></td> -- You received this message because you are subscribed to the Google Groups "web.py" group. To view this discussion on the web visit https://groups.google.com/d/msg/webpy/-/87TvPXqR-rcJ. To post to this group, send email to webpy@googlegroups.com. To unsubscribe from this group, send email to webpy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.