Hola,<br><br>He creado tu ejemplo en my base de datos de test. Prueba esto a ver:<br><br>import MySQLdb<br>conn = MySQLdb.connect (host="localhost", user=XXXXXXXXXX, passwd=YYYYYYYYYYYYYY, db="test")<br>
cursor = conn.cursor()<br>cursor.execute("select id, Nombre from cotizaciones_valores where id=1")<br>resultado=cursor.fetchone()<br>>>> print(resultado)<br>('1', 'telef\xc3\xb3nica Espa\xc3\xb1a')<br>
id_Valor= resultado[0]<br>Nombre_Valor= resultado[1]<br>print(Nombre_Valor)<br><<<<<<<<<<<<<<<<<< telefónica España<br>archivo_configuracion= open( 'gnuplot.dem', 'w')<br>
archivo_configuracion.write("set title '%s (%s)'\n" % ( Nombre_Valor, id_Valor,))<br>archivo_configuracion.close()<br>archivo_configuracion = open('gnuplot.dem', 'r')<br>linea = archivo_configuracion.readline()<br>
print(linea)<br><<<<<<<<<<<<<<<<<<<set title 'telefónica España (<built-in function id>)'<br>archivo_configuracion.close()<br><br>Yo también estoy aprendiendo, eh! Así que si alguien ve algo que esté muy mal que avise, xD!<br>
<br>Saludos,<br><br>Raúl<br><br><div class="gmail_quote">2011/2/28 Dr. Bobus <span dir="ltr"><<a href="mailto:drbobus@gulic.org">drbobus@gulic.org</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
El Mon, 28 Feb 2011 20:08:15 +0100<br>
Jesús Genicio <<a href="mailto:jgenicio@gmail.com">jgenicio@gmail.com</a>> dijo:<br>
<div class="im"><br>
><br>
> He intentado utilizar tu código pero me da errores igualmente.<br>
><br>
> He adjuntado a pastebin el código completo, si alguien me puede<br>
> ayudar...<br>
><br>
> <a href="http://pastebin.com/x3DFTkjD" target="_blank">http://pastebin.com/x3DFTkjD</a><br>
><br>
<br>
<br>
</div>Hola Jesus:<br>
<br>
¿En la linea 25 de tu código type(resultado[ 1]) que devuelve ??<br>
<br>
<br>
Saludos<br>
<br>
<br>
Dr. Bobus<br>
<br>
- --<br>
[In 'Doctor' mode], I spent a good ten minutes telling Emacs what I<br>
thought of it. (The response was, 'Perhaps you could try to be less<br>
abusive.')<br>
(Matt Welsh)<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.10 (GNU/Linux)<br>
<br>
iEYEARECAAYFAk1sFm8ACgkQVO2xr8e6gc5EtQCcCvB5TeeQUekZBFFSiBet2sfY<br>
FmcAniMSpzChi92K2MKR7Vi40pcoToP/<br>
=fs0E<br>
-----END PGP SIGNATURE-----<br>
<div><div></div><div class="h5">_______________________________________________<br>
Python-es mailing list<br>
<a href="mailto:Python-es@python.org">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><br><br clear="all"><br>-- <br>Raúl Cumplido<br>