我有这样的Python汤:
<p>
<span style="text-decoration: underline; color: #3366ff;">
Title:
</span>
Info
</p>
<p>
<span style="color: #3366ff;">
<span style="text-decoration: underline;">
Title2:
</span>
</span>
Info2
</p>
Run Code Online (Sandbox Code Playgroud)
我想让它看起来像这样:
<p>
Title:
Info
</p>
<p>
Title2:
Info2
</p>
Run Code Online (Sandbox Code Playgroud)
有没有办法用bs4做到这一点?
我正在使用mocha,supertest和assert来测试我的Express应用程序.My Express应用程序在开发模式下运行,因此只要请求失败,它就会以JSON形式返回有用的调试信息.我想在我的测试套件中打印这些数据,但仅在测试失败时才打印.我的一个测试的例子(在CoffeeScript中):
assert = require "assert"
request = require "supertest"
url = request "http://localhost:3000"
describe "GET /user/:id", ->
it "should return one user", (done) ->
url
.get("/user" + id)
.expect(200)
.expect("Content-Type", /json/)
.end (err, res) ->
if err
done err
else
# assuming the test reaches here, but fails on one of the following,
# how do i make mocha print res.body?
assert.equal(res.body.name, user.name)
assert.equal(res.body.email, user.email)
done()
Run Code Online (Sandbox Code Playgroud)
我如何制作mocha print res.body,但仅在测试失败时?如果可能的话,我宁愿不必console.log(res.body) if test.failed在每个describe区块中放置类似的东西.
假设我有一碗汤,我想删除所有段落的所有样式标签。所以我想把整个汤都放进<p style='blah' id='bla' class=...>去。<p id='bla' class=...>但我不想碰<img style='...'>标签。我该怎么做?