text = "A2A"
s = filter(lambda ch: ch in '0123456789', text)
print int(s)

Python过滤的更多相关文章

  1. 信息领域热词分析系统--python过滤

    利用python过滤去没用的词语,过滤的词语存储在停用文件中. #创建停用词表 def stopwordlist(): stopwords=[line.strip() for line in open ...

  2. python过滤文件中特殊标签

    Beautiful Soup Beautiful Soup 是用Python写的一个HTML/XML的解析器,它可以很好的处理不规范标记并生成剖析树(parse tree). 它提供简单又常用的导航( ...

  3. 【Python】Python 过滤列表

    如你所知,Python 具有通过列表解析将列表映射到其它列表的强大能力.这种能力同过滤机制结合使用,使列表中的有些元素被映射的同时跳过另外一些元素.过滤列表语法: [mapping-expressio ...

  4. Python 过滤字母和数字

    [前言]在写爬虫时,正则表达式有时候比较难写,一个是自己不熟练,二者数据分析提取数据千奇百怪. 一.好在python有个re模块,提供了很多更加简便的方法:可参考此文档:https://www.cnb ...

  5. python 过滤出某后缀名文件

    以从某文件夹过滤出py文件为例: 法1: import glob import os os.chdir(“./”) for file in glob.glob(“*.py”): print file ...

  6. python 过滤html方法

    from HTMLParser import HTMLParser class MLStripper(HTMLParser): """ 过滤html方法 "&q ...

  7. python 过滤文本中的标点符号(转)

    网上搜到的大都太复杂,最后找到一个用正则表达式实现的: import re s = "string. With. Punctuation?" # 如果空白符也需要过滤,使用 r'[ ...

  8. python 过滤四字节字符 表情字符

    项目中有时需要过滤掉四字节以上的字符(表情),比如mysql数据库5.5.3以下的版本text字段不支持四字节以上字符 于是就需要过滤掉再入库,python中的方法为:   try:   # pyth ...

  9. python过滤 Kubernetes api数据

    一.需求分析 Kubernetes endpoints api地址 http://ip地址:端口/api/v1/namespaces/default/endpoints services api地址 ...

  10. Python过滤emoji

    参考博客:http://my.oschina.net/jiemachina/blog/189460 1. 将emoji表情替换为指定字符串 import re def filter_emoji(des ...

随机推荐

  1. spring 配置多数据源 (可行)

    可以看到AbstractRoutingDataSource获取数据源之前会先调用determineCurrentLookupKey方法查找当前的lookupKey,这个lookupKey就是数据源标识 ...

  2. [PWA] Customize the Splash Screen of a PWA built with create-react-app

    Android displays a splash screen for PWAs based on the icons and names you provide, but iOS just dis ...

  3. Exposing the Outlook Password Secrets

    Exposing the Outlook Password Secrets - www.SecurityXploded.comhttp://securityxploded.com/outlookpas ...

  4. CMake 按照文件目录组织VS工程的筛选器

    macro(group_src_by_dir src_files) foreach(file_path ${${src_files}}) relative_path ${file_path}) str ...

  5. 推荐系统学习(2)——基于TF-IDF的改进

    使用用户打标签次数*物品打标签次数做乘积的算法尽管简单.可是会造成热门物品推荐的情况.物品标签的权重是物品打过该标签的次数,用户标签的权重是用户使用过该标签的次数.从而导致个性化的推荐减少,而造成热门 ...

  6. Linux(Centos)——下升级python3.3

    CentOS下的Python版本一般都比较低,很多应用都需要升级python来完成.我装的centOS的默认的python版本是V2.4.3,但运行node.js需要的版本是2.5以上. 1.下载py ...

  7. python——super()

    一.问题的发现与提出 在Python类的方法(method)中,要调用父类的某个方法,在Python 2.2以前,通常的写法如代码段1: class A: def __init__(self): pr ...

  8. 快速接入 Android BLE 开发的基础框架

    代码地址如下:http://www.demodashi.com/demo/12092.html ** Android BLE基础操作框架,基于回调,操作简单.包含扫描.多连接.广播包解析.服务读写及通 ...

  9. How to Start a New Cocos2d-x Game for version 3.0

    This documentation will show you how to use cocos console to create and run a new project. Runtime R ...

  10. MySQL 数据库备份种类以及经常使用备份工具汇总

    mysql> flush tables with read lock; Query OK, 0 rows affected (0.00 sec) mysql> show master st ...