Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. ## file two
  2. ## nomber 3.4
  3.  
  4. file_in = open("input.txt", "r")
  5. file_out = open("output.txt", "w")
  6. word = input().lower() #читаем с консоли слово и переводим в нижний регистр
  7.  
  8. cnt_str = 1 #счетчик строк
  9. for line in file_in :
  10.     line = line.lower()
  11.     line = line.split()
  12.     cnt_clm = 1 #счетчик позиции в строке. Нумерация с единицы.
  13.     for el in line :
  14.         if word == el : #если искомое слово равно слову из файла то выводим координаты
  15.             file_out.write(str(cnt_str) + " " + str(cnt_clm) + "\n")
  16.         cnt_clm += 1
  17.     cnt_str += 1
  18.  
  19. file_out.close()
  20. file_in.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement