• Python正则表达式练习


    # 一. 判断字符串是否是全部小写(s1 = 'adkkdk' s2 = 'abc123efg')
    # import re,time
    # s1 = 'adkkdk'
    # s2 = 'abc123efg'
    # if re.findall('[a-z]*',s1):
    # print('s1全部为小写')
    # else :
    # print('鬼才知道是不是小写')
    # if not re.findall('d*',s2):#如果包含数字就不是全部小写
    # print('s2全部为小写')
    # else :
    # print('鬼才知道是不是小写')
    # print(time.ctime())
    # Mon Feb 26 10:01:13 2018
    # F:PythonPythonLeaningvenvScriptspython.exe F:/Python/PythonLeaning/测试专用文件夹/正则表达式练习.py
    # s1全部为小写
    # 鬼才知道是不是小写
    #
    # Process finished with exit code 0
    #####################################################################################################
    # 二. 首字母缩写词扩充
    # 具体示例
    # FEMA Federal Emergency Management Agency
    # IRA Irish Republican Army
    # DUP Democratic Unionist Party
    # FDA Food and Drug Administration
    # OLC Office of Legal Counsel
    # 分析
    # 缩写词  FEMA
    # 分解为  F*** E*** M*** A***
    # 规律   大写字母 + 小写(大于等于1个)+ 空格
    # import time,re
    # s1 = 'Federal Emergency Management Agency'
    # s2 = 'Irish Republican Army'
    # s3 = 'Democratic Unionist Party'
    # s4 = 'Food and Drug Administration'
    # s5 = 'Office of Legal Counsel'
    # res = re.split('[^A-Z]+',s1)
    # res1 = "".join(res)
    # print(res1+'的扩展形式是: '+s1)
    ########################################################################################################
    # F:PythonPythonLeaningvenvScriptspython.exe F:/Python/PythonLeaning/测试专用文件夹/正则表达式练习.py
    # FEMA的扩展形式是:
    # Federal Emergency Management Agency
    # Process finished with exit code 0
    ###########################################################################################################


    Win a contest, win a challenge
  • 相关阅读:
    idea的一些常用快捷键
    php加密总结
    C 简单1
    webpack window 添加ES6支出
    webpack window 添加第三方库
    webpack window 处理图片和其他静态文件
    webpack window 使用sass来编译css样式
    webpack window 安装loader
    webpack window dev-server配置
    webpack window下配置的hello world
  • 原文地址:https://www.cnblogs.com/pandaboy1123/p/8476907.html
Copyright © 2020-2023  润新知