Hows
‣
‣
p tags from an html file?‣
‣
‣
open(file_name, 'rb') and open(file_name, 'r')?‣
‣
Whats
‣
‣
‣
p tags from an html file?open(file_name, 'rb') and open(file_name, 'r')?from bs4 import BeautifulSoup
with open("file.extension", "r") as f:
contents = f.read()
soup = BeautifulSoup(contents, 'lxml')
p_tags = soup.find_all("p");
p_tags.get_text()
arr = []
for p_tag in p_tags:
arr.append(p_tag.get_text())
import os, sys
fd = os.open('CleanCode1.md', os.O_RDWR|os.O_CREAT)
os.write(fd, str.encode("\n".join(arr)))
os.close(os.open('CleanCode1.md', os.O_RDWR))
with open('CleanCode1.md') as f:
f.read_lines()