Question: from __future__ import print_function ''' Week Two Assignment 1 - File Processing ''' ''' Complete the script below to do the following: 1) Add your
from __future__ import print_function
''' Week Two Assignment 1 - File Processing '''
''' Complete the script below to do the following: 1) Add your name, date, assignment number to the top of this script 2) Open the file redhat.txt a) Iterate through each line of the file b) Split eachline into individual fields (hint str.split() method) c) Examine each field of the resulting field list d) If the word "worm" appears in the field then add the worm name to the set of worms e) Once you have processed all the lines in the file sort the set iterate through the set of worm names print each unqiue worm name 3) Submit NamingConvention: lastNameFirstInitial_Assignment_.ext for example: NAME_WK2-1_script.py NAME_WK2-2_screenshot.jpg A) Screenshot of the results in WingIDE B) Your Script '''
import os
SCRIPT_NAME = 'ASSIGNMENT NAME' SCRIPT_VERSION = 'VERSION #' SCRIPT_AUTHOR = 'MY NAME' SCRIPT_DATE = 'DATE'
uniqueWorms = set()
with open("redhat.txt", 'r') as logFile: for eachLine in logFile: ''' your code starts here '''
str = eachLine.split() print(str)
I am very confused on what to do next. I am on step C and I am stuck. Any help would be very helpful. Python
I don't need that file exactly just an idea of the code so I have an idea
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
