Advertisement
stoneman

Uredjivac

May 28th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. import os,sys
  2.  
  3. def main():
  4.     os.system('clear')
  5.     ukupno_reci = 0
  6.     izbacene_reci = 0
  7.     upisane_reci = 0
  8.  
  9.     granica = int(raw_input("Granica: "))
  10.     pathIN  = raw_input("Fajl ulaz: ")
  11.     pathOUT = raw_input("Fajl izlaz: ")
  12.  
  13.     fajlIN = open(pathIN, "r")
  14.     fajlOUT = open(pathOUT,"w")
  15.     temp = fajlIN.readline()
  16.    
  17.         granica = granica+1
  18.  
  19.     while(temp != ""):
  20.         broj_slova = len(temp)     
  21.         if(broj_slova <= granica):
  22.             fajlOUT.write(temp)
  23.             upisane_reci = upisane_reci+1
  24.         else:
  25.             izbacene_reci = izbacene_reci+1
  26.         ukupno_reci = ukupno_reci+1
  27.         temp = fajlIN.readline()
  28.         sys.stdout.write(".")
  29.        
  30.    
  31.     print "\nUkupno reci: ", ukupno_reci
  32.     print "Izbacene reci: " , izbacene_reci
  33.     print "Upisane reci: " , upisane_reci
  34.  
  35.     if((izbacene_reci + upisane_reci) == ukupno_reci):
  36.         print "\n Sve je ok!"
  37.     else:
  38.         print "\n Nesto nije u redu"
  39.  
  40.     fajlIN.close()
  41.     fajlOUT.close()
  42.  
  43.  
  44. if __name__ == "__main__":
  45.         main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement