Python on the Web
Bruno Desthuilliers
bruno.42.desthuilliers at websiteburo.invalid
Thu Sep 3 10:39:33 EDT 2009
John Nagle a écrit :
(snip)
> MySQLdb is available only up to Python 2.5.
Huh ???
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
/var/lib/python-support/python2.6/MySQLdb/__init__.py:34:
DeprecationWarning: the sets module is deprecated
from sets import ImmutableSet
>>> cnx = MySQLdb.connect(db='cress', user='cress', passwd='cress')
>>> cursor = cnx.cursor()
>>> cursor.execute("SELECT id_article, titre FROM spip_articles")
28L
>>> for row in cursor:
... print row
...
(1L, '01. Sensibilisation')
(2L, '02. Gestation')
(3L, '03. Lancement')
(4L, '04. D\xe9veloppement')
(5L, '01. Sensibilisation')
(6L, '02. Gestation')
(7L, '03. Lancement')
(8L, '04. D\xe9veloppement')
(9L, '01. Sensibilisation')
(10L, '02. Gestation')
(11L, '03. Lancement')
(12L, '04. D\xe9veloppement')
(13L, 'Nouvel article')
(14L, 'Nouvel article')
(15L, '01. Les principes fondateurs d\x92une coop\xe9rative')
(16L, '02. C\x92est quoi une COOPERATIVE ?')
(17L, '10. Les principes fondamentaux de l\x92Economie sociale et
solidaire')
(18L, '20. Les familles de l\x92Economie sociale et solidaire ')
(19L, 'Article 1')
(20L, 'Article 2')
(21L, 'Article 3')
(22L, 'Article 4')
(23L, 'Article 5')
(24L, 'Lancement du nouveau site de la CRESS')
(25L, 'Mise \xe0 jour des Formations')
(26L, "La CRESS au Salon de l'Emploi")
(27L, '01. Pr\xe9sentation')
(28L, '20. Les formations universitaires BAC +3')
>>> cursor.close()
>>> cnx.close()
>>>
Seems to work just fine here...
More information about the Python-list
mailing list