python去掉字符串中的字母,只保留数字

  • Post author:
  • Post category:python


>>> import os,sys,string

>>> s = “NaN9771Abc742055”

>>> s = filter(lambda ch: ch in ‘0123456789’, s)

>>> print s

9771742055

>>>



版权声明:本文为dongxyang原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。