开发者社区> 问答> 正文

jupyter notebook 中python报错?报错

jupyter notebook中如下代码报错

from bs4 import BeautifulSoup
html_sample = ' \
<html> \
 <body> \
    <h1 id="title">Hello World</h1> \
    <a class="link">This is link1</a> \
    <a link2" class="link">This is link2</a> \
 </body> \
</html> ' 
    
    soup = BeautifulSoup(html_sample,'html.parser') 
    print(soup.text)



报错如下

File "<ipython-input-3-721b610e6a5d>", line 4
    soup = BeautifulSoup(html_sample,'html.parser')
    ^
IndentationError: unexpected indent



求解决,学习不久,不知道如何解决

展开
收起
爱吃鱼的程序员 2020-06-08 20:25:26 536 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    str=""" dasfdsafdsafds dasfdsa """ 字符串这样
    谢谢,已解决,jupyternotebook写python的时候,代码之间不能空行,就解决了
    这么明显的锁进错误

    2020-06-08 20:25:42
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载