私信  •  关注

Stan S.

Stan S. 最近创建的主题
Stan S. 最近回复了
7 年前
回复了 Stan S. 创建的主题 » 使用单行筛选字符串python中的数字

比如:

newstring = ''.join(map(lambda x: x if not x.isdigit() else "", string.split() ))

与空格完全相同:

newstring = ' '.join(map(lambda x: x if not x.isdigit() else "", string.split() )).replace('  ', ' ')