Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.
Assume you're working on a contract where a company is building a mailing list (or, rather, an e-mailing list) by analyzing e-mail messages.
Assume you're working on a contract where a company is building a mailing list (or, rather, an e-mailing list) by analyzing e-mail messages. Your task is to write a Python program that reads a file (stored in the current working directory) called mail.dat and outputs to a file called addresses.dat, one per line, every e-mail address contained inside the file. For this assignment, if a whitespace delimited string of characters has an embedded commercial at sign (@) inside it (that is, interior to the string), we shall consider it an e-mail address. However, any trailing commas must be trimmed from addresses. Thus the string "," must appear in the output file as "" with the trailing comma removed. Only commas at the end of a string are considered trailing; do not remove non-trailing commas. Do not worry about any other punctuation characters; the only editing your program must do is to remove trailing commas.
What I have so far is the following:
def main():
mail = open('mail.dat','r')
line = mail.realine()
while line != "":
tokens = line.split()
for word in tokens:
print(tokens)
line = mail.readline()
when I run the program I get each word by itself but in a list.