please type code in Python
find all the VALID email address in this input text file and store them as a single column of valid email addresses in an output text file labeled OutputFile
First cut/paste the block of text below into a separate text file and label that data file InputFile:
FinancialAid Email: [email protected]
Scholarships Financial Aid Phone: 979-555-3236
Email: [email protected] Financial [email protected] Aid
[email protected] Help Desk Central
[email protected] Dean's Office
Jill Educational Program Coordinator II
Create a program will find all the email address in InputFile and
put into an output data file that you will label as
OutputFile
Hint: use the character "@" as a cue to help find all the potential
email addresses and then
see if you see an ".edu" or a ".net" or a...etc
You will want to check for valid email addresses ie ending in a valid extension. If you find the @ but when you test the rest of the candidate email, you don't see a valid extension simply flag it as an "ERROR" as shown in the output you should get:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
Code
f = open('inputFile.txt')
fo = open("outputFile.txt", "w")
line = f.readline()
while line:
extension=["edu","net","org","com","msv"]
lines=line.split(" ")
for word in lines:
if '@' in word:
dot=word.find(".")
if(dot>0):
ext=word[dot+1:]
while(True):
dot=ext.find(".")
if(dot>0):
ext=ext[dot+1:]
else:
break
ext=ext.rstrip()
if ext in extension:
word=word.rstrip()
fo.write(word+"\n")
else:
fo.write("Error"+word+"\n")
else:
fo.write("Error "+word+"\n")
line = f.readline()
f.close()
fo.close()
inputFile.txt
outputFile.txt
codeSnaps
If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.
One possible solution would be to use regular expressions to search for patterns that match email addresses. Here is an example of how to do this using Python:
pythonCopy codeimport re# Open the input file and read its contentswith open('InputFile.txt', 'r') as f: input_text = f.read()# Define a regular expression pattern to match email addressespattern = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'# Find all the matches in the input textmatches = re.findall(pattern, input_text)# Filter out any invalid email addressesvalid_emails = [email for email in matches if email.endswith(('.com', '.edu', '.net', '.org'))]# Write the valid email addresses to the output filewith open('OutputFile.txt', 'w') as f: f.write('\n'.join(valid_emails))
This code reads the input file into a string, defines a regular expression pattern to match email addresses, and uses the re.findall()
function to find all the matches in the input text. It then filters out any invalid email addresses by checking that the email address ends with a valid extension (.com
, .edu
, .net
, or .org
). Finally, it writes the valid email addresses to the output file.
please type code in Python find all the VALID email address in this input text file...
Java2 Screenshot of the output required Put some comment This is the mailing text file for the assignment ..Il AT&T令 12:28 AM Back Complete and Submit Lab 2C Detail Submission Grade Complete and Submit Lab 2C Due: Mar 1, 2019 at 11:59 PM In class you learned how to read text from a file using the Scanner class and write text to a file using the Formatter class. This lab allows you to apply the skills you learned about files...
C++ There are to be two console inputs to the program, as explained below. For each input, there is to be a default value, so that the user can simply press ENTER to accept any default. (That means that string will be the best choice of data type for the console input for each option.) The two console inputs are the names of the input and output files. The default filenames are to be fileContainingEmails.txt for the input file, and...
Your mission in this programming assignment is to create a Python program that will take an input file, determine if the contents of the file contain email addresses and/or phone numbers, create an output file with any found email addresses and phone numbers, and then create an archive with the output file as its contents. Tasks Your program is to accomplish the following: ‐ Welcome the user to the program ‐ Prompt for and get an input filename, a .txt...
Lab 1.4: Arrays, File I/O and Method Review (40 pts) Assume you work for a company that received a list of email addresses of potential new customers from a data broker. Your company receives a file named customers.txt with the below information: Jiming Wu [email protected] James Brown [email protected] Leanna Perez [email protected] Xing Li [email protected] Stacey Cahill [email protected] Mohammed Abbas [email protected] Kumari Chakrabarti [email protected] Shakil Smith Shakattaq2G.com Jung Ahrin [email protected] Pedro Martinez [email protected] Ally Gu [email protected] Tamara White [email protected] Alvin Ngo...
Please write this in C. Write this code in Visual Studio and upload your Source.cpp file for checking (1) Write a program to prompt the user for an output file name and 2 input file names. The program should check for errors in opening the files, and print the name of any file which has an error, and exit if an error occurs opening any of the 3 For example, (user input shown in caps in first line) Enter first...
Python Coding The script, `eparser.py`, should: 1. Open the file specified as the first argument to the script (see below) 2. Read the file one line at a time (i.e., for line in file--each line will be a separate email address) 3. Print (to the screen) a line that "interprets" the email address as described below 4. When finished, display the total number of email addresses and a count unique domain names Each email address will either be in the...
URGENT HELP NEEDED: JQuery. PLEASE POST SCREEN SHOTS Task 1: Downloading jQuery Right-click the link to download the uncompressed latest version of jQuery Copy the jQuery.x.x.x.js file in the folder and specified as source file. Task 2: Download and install HTML-Kit 1. Navigate to htmlkit.com. 2. Click Download HTML-Kit 292. After it downloads, launch HKSetup.exe. Choose Full installation (the default) Uncheck Yes, download and install HTML-Kit Tools Trial. 6. Click Next>Finish. Task 3: Creating a Simple jQuery Application Launch HTML-Kit....
i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due Sunday, 19 May 2019, 11:59 PM Due Friday, 24 May 2019, 11:59 PM Part B: Minimum Submission Requirements Ensure that your Lab4 folder contains the following files (note the capitalization convention): o Diagram.pdf o Lab4. asm O README.txt Commit and push your repository Lab Objective In this lab, you will develop a more detailed understanding of how...
In Java plz due today Assignment 4 - Email, Shwitter and Inheritance Select one option from below. All (both) options are worth the same number of points. The more advanced option(s) are provided for students who find the basic one too easy and want more of a challenge. OPTION A (Basic): Message, EMail and Tweet Understand the Classes and Problem Every message contains some content ("The British are coming! The British are coming!"). We could enhance this by adding other...
The first script is validate.sh. This is a simple form validation script that will be used to verify the inputs given. Normally, this would be done to validate input from a website or another program before entry into a database or other record storage. In this case, we will keep it simple and only focus on the input validation step. In particular, the script should prompt the user for four values: first name, last name, zip code, and email address....