Question: python Task-2: Regular Expressions are used for filtering out the text that matches a specific pattern Below is the kind of inputs you are getting

python

python Task-2: Regular Expressions are used for filtering out the text that

Task-2: Regular Expressions are used for filtering out the text that matches a specific pattern Below is the kind of inputs you are getting from web scrapping results and the line below is just one of the millions of lines you are getting. You are required to take this line as it is (without changing any thing in this line and write a code that properly cleans them and tokenize them according to the required output given below line = 'asdf fjdk; afed, fjek, asdf, foo' import re re.split (your logic here) Required Output: ['asdf', 'fjdk', 'afed', 'fjek', 'asdf', 'foo'] To solve this task you can go to : https://regexr.com/ and test out your solution there first. You will be essentially performing a split based on the regex. Task-3: You are given the file names in a list: filenames - [ 'Makefile', 'foo.c', 'bar.py', 'spam.c', 'spam.h' ] A. Write a piece of code that goes through the list and outputs only those files that ends with .C OR .h B. Write a piece of code that goes through the list of files and outputs True if any .py file exists in th list Hint: use endswith(suffix) combined with any (iterable)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!