Advertisement
Guest User

ex_08.py

a guest
Nov 23rd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. inp = input("Enter file name: ")
  2.  
  3. try:
  4.     count = 0
  5.     holder = open(inp, "r")
  6.     for line in holder:
  7.         if line.startswith("From:"):
  8.             line = line.rstrip()
  9.             adress = line.split()
  10.             print(adress[1])
  11.             count = count + 1
  12.         else:
  13.             continue
  14.     print("There were", count, "lines in the file with From as the first word")
  15.  
  16. except:
  17.     print("Not equal name")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement