Question: In this task, you will design an input file processor using object-oriented programming techniques. First, you will design a class called text_parser, which will accept



In this task, you will design an input file processor using object-oriented programming techniques. First, you will design a class called text_parser, which will accept a multiline string and separate each of this text into tokens based on the delimiter character. This processing is aking to doing line.split( delimiter) Moreover, you will need to clean up each token that will result from this processing from spaces using str.strip() call. For example In [5]: line "This, is, a ,test,string" delimiter"," tokens line.split( delimiter) print "Tokens before cleaning: ".format( tokens) ) new_tokens list( map( str.strip, tokens)) print( "Tokens after cleaning: C".format( new_tokens) ) Tokens before cleaning: 'This ',is', ' a', 'test', 'string ' Tokens after cleaning: l'This', 'is', 'a', 'test', 'string'] The API that your text_parser class will support are the following: text_parser self, multiline_string, delimiter ) should initialize a new text_parser instance based on the multiline string and the delimiter for parsing tokens
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
