Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/06/2013, 10:15
Bael_Balzac
 
Fecha de Ingreso: julio-2011
Mensajes: 62
Antigüedad: 13 años, 3 meses
Puntos: 0
Pregunta Impresión de datos (formateado de cadenas)

Existe alguna otra alternativa a la línea 11 ?
Código Python:
Ver original
  1. import numpy as np
  2.  
  3. t = np.array([0,6,12,18,24,30,36,42,48,54,60,66,72,78,84,90,96,102,108,114,120,126])
  4. I = np.array([22,23,35,71,103,111,109,100,86,71,59,47,39,32,28,24,22,21,20,19,19,18])
  5. O = np.array([22,21,21,26,34,44,55,66,75,82,85,84,80,73,64,54,44,36,30,25,22,19])
  6. I_medido = np.array([31,50,86,123,145,150,144,128,113,95,79,65,55,46,40,35,31,27,25,24,23,22])
  7. O_medido = np.array([31.0,27.8639473,27.50946632,36.16641502,54.45345972,76.48365895,96.03075768,\
  8. 110.77989121,117.60236863,119.41165035,115.89062393,108.88958298,99.46166492,89.72428831,\
  9. 79.67787179,70.48778375,62.19028931,54.97755505,48.24565838,42.54311695,38.02757641,34.39941769])
  10.  
  11. print "%s%26s%18s%19s%18s" % ("t(horas)", "I obs. (m3/seg.)", "O obs. (m3/seg.)", "I prev. (m3/seg.)",\
  12. "O calc. (m3/seg.)")
  13. print('{0} {0} {0} {0} {0}'.format('='*17))
  14. datos = [t,I,O,I_medido,O_medido]
  15. for i, datos in enumerate(t):
  16.     print('{0:>17} {1:>17.3f} {2:>17.3f} {3:>17.3f} {4:>17.3f}'.format(t[i], I[i], O[i], I_medido[i], O_medido[i]))
  17. print('{0} {0} {0} {0} {0}'.format('='*17))