Develop a crawler that collects the email addresses in the visited web pages. You can write a function emails() that takes a document (as a string) as input and returns the set of email addresses (i.e., strings) appearing in it. You should use a regular expression to find the email addresses in the document.

Answers

Answer 1
Answer:

Answer:

see explaination

Explanation:

import re

def emails(document):

"""

function to find email in given doc using regex

:param document:

:return: set of emails

"""

# regex for matching emails

pattern = r'[\w\.-]+at[\w\.-]+\.\w+'

# finding all emails

emails_in_doc = re.findall(pattern, document)

# returning set of emails

return set(emails_in_doc)

# Testing the above function

print(emails('random text ertatxyz.com yu\npopatxyz.com random another'))


Related Questions

A device that protects electronic equipment from an increase in power, but not a decrease or outage is a ___.a. Battery backupb. Surge suppressorc. CRTd. UPS
1. What is the difference between computer organization and computer architecture? 2. What is an ISA? 3. What is the importance of the Principle of Equivalence of Hardware and Software? 4. Name the three basic components of every computer. 5. To what power of 10 does the prefix giga- refer? What is the (approximate) equivalent power of 2? 6. To what power of 10 does the prefix micro- refer? What is the (approximate) equivalent power of 2?
This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user specified arrow base height, arrow base width, and arrow head width.(1) Modify the given program to use a loop to output an arrow base of height arrowBaseHeight. (1 pt)(2) Modify the given program to use a loop to output an arrow base of width arrowBaseWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow base. (1 pt)(3) Modify the given program to use a loop to output an arrow head of width arrowHeadWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow head. (2 pts)(4) Modify the given program to only accept an arrow head width that is larger than the arrow base width. Use a loop to continue prompting the user for an arrow head width until the value is larger than the arrow base width. (1 pt)while (arrowHeadWidth <= arrowBaseWidth) {// Prompt user for a valid arrow head value}Example output for arrowBaseHeight = 5, arrowBaseWidth = 2, and arrowHeadWidth = 4:Enter arrow base height:5Enter arrow base width:2Enter arrow head width:4********************This is what I have:import java.util.Scanner;public class DrawHalfArrow{public static void main(String[] args){Scanner scnr = new Scanner(System.in);int arrowBaseHeight = 0;int arrowBaseWidth = 0;int arrowHeadWidth = 0;System.out.println("Enter arrow base height:");arrowBaseHeight = scnr.nextInt();System.out.println("Enter arrow base width:");arrowBaseWidth = scnr.nextInt();while (arrowHeadWidth >= arrowBaseWidth){System.out.println("Enter arrow head width:");arrowHeadWidth = scnr.nextInt();} // Draw arrow base (height = 3, width = 2)for(int i=0; i < arrowBaseHeight; ++i){for(int j=0; j < arrowBaseWidth; ++j){System.out.print("*");}System.out.println();}// Draw arrow head (width = 4)for(int i=0; i < arrowHeadWidth; ++i){for(int j=0; j < arrowHeadWidth-i; ++j){System.out.print("*");}System.out.println();}return;}}
A common measure of transmission for digital data is the number of bits transmitted per second. Generally, transmission is accomplished in packets consisting of a start bit, a byte (8 bits) of information, and a stop bit. Using these facts, answer the following:a. Compute the time required to transmit an image of 1200x800 pixels with 8 bits for gray of each pixel using a 50 M bits/sec. modem?b.What would the time be at 3 M bits/sec, a representative of download speed of a DSL connection?(c) Repeat a and b when the image is RGB colored with 8 bits for each primary color. f 20 colored frames per second
Shortest Remaining Time First is the best preemptive scheduling algorithm that can be implemented in an Operating System. a. True b. False

g A peer-to-peer PLC network: has no master PLC. uses the token passing access control scheme. each device is identified by an address. all of these.

Answers

Answer:

All of these

Explanation:

A peer-to-peer network is a type of computer network that computer devices directly to each other, sharing information and other resources on the network.

It does not have a centralized database, there are no master or slave as each device in the network is a master on its own, and the devices all have unique addresses assigned statically for identification.

Which of the following can be used to record the behavior of classes?A) Javadoc comments

B) Nouns and verbs in the problem description

C) Polymorphism

D) UML notation

Answers

Answer:

A) Javadoc comments

Explanation:

It is used for documenting the java source code in HTML and java code documentation. The difference between multi-line comment and javadoc is that ,javadoc uses extra asterisk, For example-

/**

* This is a Javadoc

*/

It is used to record the behavior of classes.There are various tags used in this like @author,{@code},@exception and many more.

A teacher at your school is using her district issued laptop to create spreadsheets for her part-time job as a bookkeeper. Which standard, if any, is this teacher violating?

Answers

The teacher is violating the Standard 1.2 in the education section.

What did the Standard 1.2 states?

The standard states that any educator shall not knowingly misappropriate or use monies, personnel, property, or equipment committed to his or her charger for personal gain or advantage.

Hence, because of this, the teacher has violated the Standard 1.2 in the education section.

Read more about Standard 1.2

brainly.com/question/17277092

#SPJ2

Answer:

The teacher is most likely violating the District Use Policy.

Write an if statement that assigns 100 to x when y is equal to 0. 32. Write an if/else statement that assigns 0 to x when y is equal to 10. Otherwise it should assign 1 to x. 33. Using the following chart, write an if/else if statement that assigns .10, .15, or .20 to commission, depending on the value in sales. Sales Commission Rate Up to $10,000 10% $10,000 to $15,000 15% Over $15,000 20%

Answers

Answer:

1.  

if(y==0.3){ x = 100;}

2.

if(y == 10){

x = 0; }

else {

x = 1; }

3.

if(sales< 10000){

commission = 0.10;

}

else if(sales>= 10000 && sales <= 15000 ){

commission = 0.15;

}

else{

commission = 0.20;

}

Explanation:

The statements written in brackets represent the conditions while the statements in {...} represent the operation that would be executed depending on the outcome of the if statement.

For 1: if(y==0.3){ x = 100;}

If y is 0.3, 100 would be assigned to x

For 2:

if(y == 10){ x = 0; }

If y is 10, 0 would be assigned to x

else { x = 1; }

If otherwise, 1 would be assigned to x

For 3:

if(sales< 10000){commission = 0.10;}

Is sales is less than 10000, commission would be 0.10

else if(sales>= 10000 && sales <= 15000 ){commission = 0.15;}

If sales is within range of 10000-15000, commission would be 0.15

else{commission = 0.20;}

If otherwise, commission would be 0.20

Write a program that asks the user to enter two numbers,obtains the two numbers from the user and prints the sum,product,difference, and quotient of the two numbers

Answers

Answer:

#include<iostream>

using namespace std;

//main function

int main(){

   //initialization

   float a1,a2;

//display the message

cout<<"Enter the first number: ";

   cin>>a1;  //store the value

   cout<<"Enter the second number: ";

   cin>>a2;   //store the value

   //display the calculation result

   cout<<"The sum is: "<<a1+a2<<endl;

   cout<<"The Subtraction is: "<<a1-a2<<endl;

   cout<<"The product is: "<<a1*a2<<endl;

   cout<<"The Quotient is: "<<a1/a2<<endl;

}

Explanation:

Create the main function and declare the two variables of float but we can enter the integer as well.

display the message on the screen and then store the input enter by the user into the variable using the cin instruction.

the same process for second input as well, display the message and store the input.

after that, print the output of the calculation. the operator '+' is used to add the two numbers like a1+a2, it adds the number stored in the variable.

similarly, the subtraction operator is '-', product '*' and quotient operator '/'.

and finally, we get the desired output.

What is touch-typing?typing with a keyboard shortcut
typing with macros
typing with only one hand
typing without looking at the keyboard

Answers

Typing without looking at the keyboard and using all fingers. I do this, so I'm 99% that's the correct answer.
Typing without looking at the keyboard.

Last one