BeautifulSoup实体引用应该怎样做,beautifulsoup实体,template = c
BeautifulSoup实体引用应该怎样做,beautifulsoup实体,template = c
template = codecs.open('template.html', 'r' , 'utf-8')template = template.read()template = bs(template)resp = requests.get('http://blog.jobbole.com/61171/')html = resp.text.encode('utf-8')html = bs(html)t = html.title.stringtemplate.title.string = ttemplate.div.string = str(html.select('div.entry')[0])out = codecs.open(''.join(['result/', t, '.html']), 'w' , 'utf-8')# out.write(str(template))# print(template)print(str(html.select('div.entry')[0]))
如果直接输出 str(html.select('div.entry')[0]) 时尖括号不会转义,
但输出 template 就会转义。
现在我想让template就保持原样(既不escape也不unescape)应该怎样做呢?谢谢大家了。
编橙之家文章,
相关内容
- supervisord event如何配置添加,supervisordevent,如何配置su
- 要在项目中扩展下载类库应该用什么方法,项目类库
- Python 正则中文网页字符串提取问题,python中文网页,&
- 请问这个Python程序运行原理是什么,Python程序运行原理
- 需要为遵守PEP8修改自己python代码吗,遵守pep8python代码
- Python利用二分法计算平方根哪里出问题了,python二分法
- 新手请教关于Flask-sqlalchemy、Flask-WTF结合查询的问题,
- Python实现批量生成字符串最佳思路是什么,python思路
- Python2.7遍历包含一个dict的tuple变量应该怎么写,python
- 实现qml+python打包成exe小程序问题,qmlpython,我写了一个
评论关闭