脚本:
#!/usr/bin/python3.2
from bs4 import BeautifulSoup as bs
content = '<p class="title">hello world</p>'
s = bs(content)
print(s.find_all(class="title"))
输出:
File "bs.py", line 7
print(s.find_all(class="title"))
^
SyntaxError: invalid syntax
BS文档:
soup.find_all(id="link2")
# [<a class="sister" href="http://example.com/lacie" id="link2">Lacie</a>]
问题:为什么会出现语法错误?