python预处理删除特殊字符_python - 如何删除包含特殊字符的字符串?_others_酷徒编程知识库...

我试图删除所有包含特殊字符的字符串。description_list = ['$', '2,850', 'door', '.', 'sale', '...', 'trades', '.', 'pay', 'pp', 'fees', 'shipping', 'cost', 'desirable', 'x932', 'liner', 'dialx94', 'eta', 'movement', 'watch', 'x93safe', 'queenx94', ',', 'pristine', 'condition', '.', 'ix92m', 'original', 'owner', 'worn', 'watch', 'gently', 'handful', 'times', '.', 'protective', 'plastics', 'still', 'intact', 'case', 'back', ',', 'parts', 'clasp', 'full', 'original', 'kit', 'youx92ll', 'see', 'pics', '.', 'includes', 'original', 'boxes', ',', 'manuals', ',', 'warranty', 'card', 'ad', ',', 'spare', 'bracelet', 'links', ',', 'dive', 'strap', '&', 'extension', ',', 'etc', 'payment', 'paypal', ',', 'due', 'quickly', 'upon', 'agreement', 'purchase', 'watch', '.', 'holds', ',', 'delays', ',', 'games', '.', 'pay', 'pp', 'fees', 'shipping', 'us', 'postal', 'service', 'priority', 'mail', 'w/signature', 'confirmation', ',', 'paypal', 'verified', 'address', 'inside', 'usa', '.', 'please', 'donx92t', 'ask', 'ship', 'outside', 'usa', '.', 'exceptions', 'made', '.', 'please', 'e-mail', '[', 'email', 'protected', ']', '.', 'also', 'text', 'call', '210-705-3383.', 'name', 'james', 'crockett', 'thank', ',', 'james', 'crockett', '$', '2,850', 'door', '.', 'sale', '...', 'trades', '.', 'pay', 'pp', 'fees', 'shipping', 'cost', 'desirable', 'x932', 'liner', 'dialx94', 'eta', 'movement', 'watch', 'x93safe', 'queenx94', ',', 'pristine', 'condition', '.', 'ix92m', 'original', 'owner', 'worn', 'watch', 'gently', 'handful', 'times', '.', 'protective', 'plastics', 'still', 'intact', 'case', 'back', ',', 'parts', 'clasp', 'full', 'original', 'kit', 'youx92ll', 'see', 'pics', '.', 'includes', 'original', 'boxes', ',', 'manuals', ',', 'warranty', 'card', 'ad', ',', 'spare', 'bracelet', 'links', ',', 'dive', 'strap', '&', 'extension', ',', 'etc', 'payment', 'paypal', ',', 'due', 'quickly', 'upon', 'agreement', 'purchase', 'watch', '.', 'holds', ',', 'delays', ',', 'games', '.', 'pay', 'pp', 'fees', 'shipping', 'us', 'postal', 'service', 'priority', 'mail', 'w/signature', 'confirmation', ',', 'paypal', 'verified', 'address', 'inside', 'usa', '.', 'please', 'donx92t', 'ask', 'ship', 'outside', 'usa', '.', 'exceptions', 'made', '.', 'please', 'e-mail', '[', 'email', 'protected', ']', '.', 'also', 'text', 'call', '210-705-3383.', 'name', 'james', 'crockett', 'thank', ',', 'james', 'crockett']

price_list = [x for x in description_list if any(c.isdigit() for c in x)]

输出# price_list

['2,850', 'x932', '210-705-3383.', '2,850', 'x932', '210-705-3383.']

['2,850','2,850']

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值