Reputation: 33
I take a string paragraph as input then use rstrip()
to strip it into rows, then split() to strip each row into words.
So I'm left with a column of strings:
Barry Sally Andrew Jonathan ...
How can I create a list from this output?
(I want this as output) => ['Barry', 'Sally', 'Andrew', 'Jonathan', ...]
file_name = input("Enter file name: ")
file_holder = open(file_name)
for line in file_holder:
# strip into rows
line = line.rstrip()
if not line.startswith("From "): continue
# strip into words
words = line.split()
email_list = words[1]
print(email_list)
Thanks
Upvotes: 0
Views: 58