Advertisement
Guest User

Untitled

a guest
Jun 12th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. in_file = open("tekst.txt", "r")
  2. out_file = open("formatiranje.txt", "w")
  3.  
  4. string_text = in_file.read().split()
  5. count = 0
  6.  
  7. for word in string_text:    
  8.     if "." in word or "!" in word or "?" in word:        
  9.         out_file.write(word + "\n")
  10.         count += 1
  11.     else:
  12.         out_file.write(word + " ")
  13. in_file.close()
  14. out_file.close()
  15.  
  16. print "Broj rečenica je:", count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement