getPostsWithAnswers.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:BiLSTM-CCM 作者: codedecde 项目源码 文件源码
def getFirstPostData(forum_text):
    soup = BeautifulSoup(forum_text)
    title = ""
    date = ""
    body = ""
    try:
        date = soup.find("div", attrs={"class": "postDate"}).text
    except AttributeError:
        print "Date not found"
    try:
        title = soup.find("div", attrs={"class": "postTitle"}).text
    except AttributeError:
        print "Title not found"
    try:
        body = soup.find("div", attrs={"class": "postBody"}).text
    except AttributeError:
        print "Body not found, now this is weird"
    return [title,date,body]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号