Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file = open(input("Input file name>> "), 'r', encoding='utf-8')
- wordCount = 0
- for row in file.readlines():
- row = row.rstrip()
- if row.startswith('From'):
- print(row.split()[1])
- wordCount += 1
- print(f'There were {wordCount} lines in the file with From as the first word')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement