perdon ... a los 3!!!!!!!!!!!!!<br><br><div class="gmail_quote">2010/6/18 monoBOT <span dir="ltr">&lt;<a href="mailto:monobot.soft@gmail.com">monobot.soft@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
muchas gracias a los 2!!!<div><br><br><div class="gmail_quote">2010/6/18 Antonio Beamud Montero <span dir="ltr">&lt;<a href="mailto:antonio.beamud@gmail.com" target="_blank">antonio.beamud@gmail.com</a>&gt;</span><div><div>
</div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
monoBOT escribió:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>
Hola ... como puedo obtener la cantidad de columnas de una tabla?<br>
<br>
hice lo siguiente de modo rudimentario pero seguramente existe una forma mucho mas directa ... alguna pista?<br>
<br>
<br>
orden = &#39;SELECT * FROM nombretabla WHERE id = 1&#39; cursor.execute(orden)<br>
 for objeto in cursor:<br>
    valor = len(objeto)-1<br></div></div>
------------------------------------------------------------------------<br>
<br>
  <br>
</blockquote>
<br>
de <a href="http://www.python.org/dev/peps/pep-0249/" target="_blank">http://www.python.org/dev/peps/pep-0249/</a>:<br>
<br>
Cursor Objects should respond to the following methods and<br>
   attributes:<br>
<br>
       .description                     This read-only attribute is a sequence of 7-item<br>
           sequences.  <br>
           Each of these sequences contains information describing<br>
           one result column: <br>
             (name,               type_code,               display_size,<br>
              internal_size,               precision,               scale,               null_ok)<br>
<br>
           The first two items (name and type_code) are mandatory,<br>
           the other five are optional and are set to None if no<br>
           meaningful values can be provided.<br>
<br>
           This attribute will be None for operations that<br>
           do not return rows or if the cursor has not had an<br>
           operation invoked via the .execute*() method yet.<br>
                      The type_code can be interpreted by comparing it to the<br>
<br>
<br>
Es decir, si haces len(cursor.description) te dice el total de columnas.<div><div></div><div><br>
<br>
<br>
_______________________________________________<br>
Python-es mailing list<br>
<a href="mailto:Python-es@python.org" target="_blank">Python-es@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-es" target="_blank">http://mail.python.org/mailman/listinfo/python-es</a><br>
FAQ: <a href="http://python-es-faq.wikidot.com/" target="_blank">http://python-es-faq.wikidot.com/</a><br>
</div></div></blockquote></div></div></div><br></div>
</blockquote></div><br>