Beautiful Soup问题汇总
来源:互联网 发布:西门子plc编程视频 编辑:程序博客网 时间:2024/06/01 16:47
# -*- coding: utf-8 -*-# requirementsimport requests, termcolor, html2textimport os, urllib2 try: from bs4 import BeautifulSoupexcept: import BeautifulSouphtml1 =""" <div class="zm-item-answer-author-info"><span class="name">匿名用户</span></div>"""html2=""" <div class="zm-item-answer-author-info"> <span class="name">匿名用户</span> </div>"""soup1 = BeautifulSoup(html1)print soup1.find_all("div", class_="zm-item-answer-author-info")[0].string# 匿名用户print soup1.find_all("div", class_="zm-item-answer-author-info")[0].text# 匿名用户soup2 = BeautifulSoup(html2)print soup2.find_all("div", class_="zm-item-answer-author-info")[0].string# Noneprint soup2.find_all("div", class_="zm-item-answer-author-info")[0].text.strip()# 匿名用户
1 0
- Beautiful Soup问题汇总
- Beautiful Soup
- Beautiful Soup
- Beautiful Soup
- Beautiful Soup
- Beautiful Soup
- Beautiful Soup 中文文档
- Beautiful Soup 中文教程
- Beautiful Soup 中文文档
- Beautiful Soup 中文文档
- python Beautiful Soup文档
- Beautiful Soup 安装
- beautiful soup功能
- Beautiful Soup安装
- HDU 4782 Beautiful Soup
- 安装beautiful soup
- Python Beautiful Soup简介
- Beautiful Soup 中文文档
- 王学岗属性动画上(十一)——属性动画的综合应用
- apt-get update报错问题
- matlab曲线拟合
- 昌大软院大神养成计划之网页设计之路第八天
- 对表的一些基本操作
- Beautiful Soup问题汇总
- 指令汇B新闻客户端开发(一) 新手引导页开发
- MAC中Android Studio快捷键(一)
- 一种与服务器交互的方式
- 数据存储之用户输入内容长度限制
- SwipeToDismiss实现左右滑动删除Listviewk
- arm-linux-androideabi-g++: error: CreateProcess: No such file or directory make.exe: *** [obj/local/
- 学习日志(2)
- iOS之UIButton无法显示文字