Ver Mensaje Individual
  #2 (permalink)  
Antiguo 06/08/2009, 12:21
Avatar de razpeitia
razpeitia
Moderador
 
Fecha de Ingreso: marzo-2005
Ubicación: Monterrey, México
Mensajes: 7.321
Antigüedad: 19 años, 2 meses
Puntos: 1360
Respuesta: python y mysql

Código python:
Ver original
  1. keri = 'SELECT Fecha FROM tris_classic;'
  2. C.execute(keri)
  3. res = C.fetchall()
  4.  
  5. fecha = ""
  6. while not fecha:
  7.     fecha = raw_input('Introduce Fecha yyyy-mm-dd:')
  8.  
  9. num = raw_input('Introduce el número:')
  10. numero = list(num)
  11. while not numero or len(numero) != 5:
  12.     num = raw_input('Introduce el numero:')
  13.     numero = list(num)
  14.  
  15. for i in res:
  16.     if fecha != i[0]:
  17.         otrokeri = "INSERT INTO tris_classic (Fecha, No1, No2, No3, No4, No5) VALUES('%s','%s','%s','%s','%s','%s');" % (fecha, numero[0], numero[1], numero[2], numero[3], numero[4])
  18.         C.execute(otrokeri)
  19.         print 'Actualización Exitosa!!!'
  20.     else:
  21.         print 'Ya existe ese registro!!!'

Por favor trata de usar la etiqueta [HIGHLIGHT="python"]Aqui va el codigo[/HIGHLIGHT no olvides el corchete del final yo se lo quite para que apareciera :p