Fork me on GitHub

python3去除字符串中括号及括号里面的内容

a = """

    <option value="search-alias=arts-crafts-intl-ship">Arts & Crafts</option>
    <option value="search-alias=automotive-intl-ship">Automotive</option>
    <option value="search-alias=baby-products-intl-ship">Baby</option>
"""

print(re.sub('\\<.*?\\>','',a))

#输出结果为:
   Arts & Crafts
Automotive
  
Baby

 
 

 

posted @ 2019-04-10 13:58  猿起缘灭  阅读(8251)  评论(0编辑  收藏  举报