Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pendave opened this issue May 25, 2017 · 1 comment
Open

Comments

@pendave
Copy link

pendave commented May 25, 2017

#给 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 pendave changed the title 给hi标签设置居中 body.find('h1')['style'] = "text-align:center;" 给h1标签设置居中 body.find('h1')['style'] = "text-align:center;" May 25, 2017
@pendave
Copy link
Author

pendave commented May 25, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant