is it return error?
12.1 (2 pts) In Section 4.3, pages 112-114 discuss four ways of reading text from a file. The first way to read text from a file is shown in the listing at the bottom of page 112. On line 4 of that listing we see: content = infile.read() After this line of code is executed, what would type (content) return? 12.2 (5 pts) The second way to read text from a file is shown in the middle of p. 113. On line 7 of that listing we see: wordList - content.split() What does the .split() method do, and what is stored in wordList as a result? One way to access the text file content is to read the content of the file into a string object. This pattern is useful when the file is not too large and string operations will be used to process the file content. For example, this pattern can be used to search the file content or to replace every occurrence of a substring with another We illustrate this pattern by implementing function numChars(), which takes the name of a file as input and returns the number of characters in the file. We use the read() function to read the file content into a string: t.py def numChars (filename): returns the number of characters in file filename infile = open(filename, 'r') content - infile.read() infile.close() return len(content) The file reading pattern we discuss next is useful when we need to process the words of a file. To access the words of a file, we can read the file content into a string and use the string split() function, in its default form, to split the content into a list of words. (So, our definition of a word in this example is just a contiguous sequence of nonblank characters.) We illustrate this pattern on the next function, which returns the number of words in a file. It also prints the list of words, so we can see the list of words. Module: text.py def numWords (filename): returns the number of words in file filename! infile = open(filename, '') content - infile.read() #read the file into a string infile.close() wordList - content.split() split file into list of words # print list of words too print (wordList) return len (wordList) i n our example tile