read page source from text file python code example Example: read page source from text file python with open("file.txt") as f: bs = BeautifulSoup(f.read())