我有字符串bp,设置为
s1 = '[\'<li class="list__item">Accommodates most miter saws; free adapter brackets ' \
'for offset mounting holes with holes included</li>\', \'<li class="list__item">' \
'Trigger handle quick release tool mounts for mounting or removing miter saw ' \
'quickly and easily</li>\', \'<li class="list__item">Adjustable arms extend out to ' \
'provide 116 in. of material support</li>\', \'<li class="list__item">Fast and easy ' \
'setup with snap pin lock folding legs</li>\', \'<li class="list__item">Easy height ' \
'adjustment of material supports with no tools required</li>\', \'<li ' \
'class="list__item">Stand collapses down quickly for easy storage and transport</li>\', ' \
'\'<li class="list__item">20 in. quick attach tool mounts may be used as miter saw base ' \
'on most surfaces</li>\', \'<li class="list__item">Durable powder-coated finish</li>\', ' \
'\'<li class="list__item">Includes: folding portable miter saw stand and operator ' \
' manual</li>\', \'<li class="list__item">90-day returnable</li>\']'
我想删除所有&#39; [\&#39;和\以及逗号 我有什么方法可以做到吗?
答案 0 :(得分:0)
您没有说明要替换它们,所以我会用空字符串替换它们
#!python3
s1 = '[\'<li class="list__item">Accommodates most miter saws; free adapter brackets ' \
'for offset mounting holes with holes included</li>\', \'<li class="list__item">' \
'Trigger handle quick release tool mounts for mounting or removing miter saw ' \
'quickly and easily</li>\', \'<li class="list__item">Adjustable arms extend out to ' \
'provide 116 in. of material support</li>\', \'<li class="list__item">Fast and easy ' \
'setup with snap pin lock folding legs</li>\', \'<li class="list__item">Easy height ' \
'adjustment of material supports with no tools required</li>\', \'<li ' \
'class="list__item">Stand collapses down quickly for easy storage and transport</li>\', ' \
'\'<li class="list__item">20 in. quick attach tool mounts may be used as miter saw base ' \
'on most surfaces</li>\', \'<li class="list__item">Durable powder-coated finish</li>\', ' \
'\'<li class="list__item">Includes: folding portable miter saw stand and operator ' \
' manual</li>\', \'<li class="list__item">90-day returnable</li>\']'
s1 = s1.replace("[", "").replace("\\", "").replace(",", "").replace("]", "")
print(s1)