Bernard Asked:2020-12-10 21:34:09 +0000 UTC2020-12-10 21:34:09 +0000 UTC 2020-12-10 21:34:09 +0000 UTC 使用正则表达式从字符串中删除元素 772 如何使用库从字符串中删除元素re 这是我的代码: a = 'I like (TV) and (1988)' re.sub(r'TV\)','',a) 一切正常,除了还剩下一把弓: 'I like ( and (1988)' 我怎样才能确保多余的弓与弓中的内容一起被删除? python 1 个回答 Voted Best Answer Dmitry Erohin 2020-12-10T21:44:44Z2020-12-10T21:44:44Z a = 'I like (TV) and (1988)' print(re.sub(r'\(TV\)','',a))
1 个回答