python_scripts icon indicating copy to clipboard operation
python_scripts copied to clipboard

给h1标签设置居中 body.find('h1')['style'] = "text-align:center;"

Open pendave opened this issue 8 years ago • 1 comments

#给 h1 tag 设置居中属性
body.find('h1')['style'] = "text-align:center;"

这时候要用

body = soup.find(class_="article-intro")

#body = soup.find_all(class_="article-intro") #如果用find_all 那后面就要用 html = h[1:-1] 去掐头去尾 去掉 [ 和 ]

pendave avatar May 25 '17 03:05 pendave

find_all 我也试了下 可以这样写 qq 20170526001233 效果可以: qq 20170526001821

pendave avatar May 25 '17 16:05 pendave