pyt6.py 1.6 KB

1234567891011121314151617181920
  1. #!/usr/bin/env python
  2. #-*- coding: utf-8 -*-
  3. # this programme compare a text in french and its translation in englishe and liste the common words .
  4. textFr ="L'année 1866 fut marquée par un événement bizarre, un phénomène inexpliqué et inexplicable que personne n'a sans doute oublié. Sans parler des rumeurs qui agitaient les populations des ports et surexcitaient l'esprit public à l'intérieur des continents les gens de mer furent particulièrement émus. Les négociants, armateurs, capitaines de navires, skippers et masters de l'Europe et de l'Amérique, officiers des marines militaires de tous pays, et, après eux, les gouvernements des divers États des deux continents, se préoccupèrent de ce fait au plus haut point. "
  5. textEn = "THE YEAR 1866 was marked by a bizarre development, an unexplained and downright inexplicable phenomenon that surely no one has forgotten. Without getting into those rumors that upset civilians in the seaports and deranged the public mind even far inland, it must be said that professional seamen were especially alarmed. Traders, shipowners, captains of vessels, skippers, and master mariners from Europe and America, naval officers from every country, and at their heels the various national governments on these two continents, were all extremely disturbed by the business. "
  6. mots=textFr.split()
  7. words=textEn.split()
  8. # for each word in the line:
  9. #for mot in mots:
  10. # print the "mot"
  11. #print(mot)
  12. #for word in words:
  13. # print the "word"
  14. #print(word)
  15. for word in words:
  16. for mot in mots:
  17. if word == mot :
  18. print(word)