"""Programa creado por M8AX, para analizar un texto y sacar de el, el numero de lineas que tiene el numero de caracteres totales, el numero de caracteres de cada letra o simbolo del texto a analizar etc... El Resultado del analisis se grabara en d: y el fichero a analizar debe estar en d: tambien...""" import appuifw, miso, e32 import graphics, thread import math, time def _raw_input( txt ): return appuifw.query( unicode( txt ), "text" ) def lechon(n): HOR=n/3600 MIN=(n /60)%60 SEG= n % 60 return (str(HOR)+"h:"+str(MIN)+"m:"+str(SEG))+"s" appuifw.app.title=u"^MvIiIaX^ DesgloseTexto" appuifw.note(u"Bienvenid@ Al Programa ^MvIiIaX^ DesgloseTexto Por Marcos Ochoa Diez.", "info" ) fich=appuifw.query(u'Nombre Del Fichero A Analizar Debe Estar En D: ', 'text',u'pelis.txt') elfinalesta="d:\\"+str(fich) archivo=open(elfinalesta,'r') contenido=archivo.readlines() totallineas=len(contenido) vector=[0]*255 longi=0 primero=time.time() diferentes=0 max=0 min=99999999999 for k in xrange(0,totallineas,1): e32.ao_yield() frase=contenido[k] longi+=len(frase) if k %500==0: print "\nPorcentaje Completado. "+str((k*100)/totallineas) for i in xrange(0,len(frase),1): e32.ao_yield() vector[ord(frase[i])]+=1 print "\nPorcentaje Completado. "+str((k*100)/totallineas) f = open( "d:\\Desglose-"+fich, "w" ) f.write( "PROGRAMA CREADO PARA DESGLOSAR UN FICHERO DE TEXTO CONTANDO SUS CARACTERES LINEAS EN EL TEXTO ETC... "+fich+"\n" ) f.write( "------------------------------------------------------------------------------------------------------------------------\n") f.write("Lineas En El Texto. "+str(totallineas)+ ".\nCaracteres Totales. "+str(longi)) f.write( "\n------------------------------------------------------------------------------------------------------------------------") for k in xrange(0,255,1): e32.ao_yield() if vector[k]>0: if vector[k]>max: max=vector[k] cara=str(chr(k)) if vector[k]