(Dec-07-2017, 12:18 PM)buran Wrote: first of all, post all of your code, traceback, output, etc. in respective tags. See BBcode help for more info.
That said, you don't need to work directly withio module
- this is going too low level. Just use built-inopen()
function to access the file. And usewith
context manager, e.g.
with open('test.html') as f: # do somethingAlso, given that this is html file, you may want to use special packages (e.g. Beautiful Soup) to parse the content of the file.re
(RegEx) in not a tool to use in this case.
I am pretty new in python. I am able to print context of a txt file and find the particular words so far. The question is that if the folder is html format then I cant open it at all. . In case I need beautiful soup to be able to have the output. my instructor walkthrough is just wrong. infile= open("filename",'r') for text and infile = open("filename",'r'utf-8') for html