• Python最新答案


    import re
    # 文本
    telNumber = '''Suppose my Phone No. is 0535-1234567, yours is 010-12345678, his is 025-87654321. '''
    # 正则表达式模式
    regular = re.compile(r'd+-d+')
    tel_list = re.findall(regular,telNumber)
    tel_str = '
    '.join(tel_list)
    print(tel_str)
    
    str= ''' dgned@123.com   sdfadf@.com  efddfd124@180.com df2dhtd@123.com  dflfdfi@139.com  feffzd.com defgdf@.sodf.com.com '''
    regular = re.compile(r'w*d*[@]w+.com|w*d*[@]d+.com')
    email_list = re.findall(regular,str)
    email_str = '
    '.join(email_list)
    print(email_str)
    
    str='aldb153   2019-03-26 14:30:00 2019-03-12 09:30:10'
    regular = re.compile(r'd{4}[-]d{2}[-]d{2} d{2}[:]d{2}[:]d{2}')
    date_list = re.findall(regular,str)
    date_str = '
    '.join(date_list)
    print(date_str)
    
    str='The shortest way 124 to do many 23111 things is to do 1689 only one thing 246 at a time'
    regular = re.compile(r'[a-zA-Z]+')
    word_list = re.findall(regular,str)
    word_str = '
    '.join(word_list)
    print(word_str)
    
    str = '''http://www.interoem.com/messageinfo.asp?id=35
    http://3995503.com/class/class09/news_show.asp?id=14
    http://lib.wzmc.edu.cn/news/onews.asp?id=769
    http://www.zy-ls.com/alfx.asp?newsid=377&id=6
    http://www.fincm.com/newslist.asp?id=415'''
        
    regular = re.compile(r'http://|/[a-z0-9.?=/_&]+')    
    domain_name = re.sub(regular,"",str)    
    domain_str = "".join(domain_name)    
    print(domain_str)
    爱我没结果!
  • 相关阅读:
    接口测试用例设计
    UI测试用例设计,场景测试法
    接口测试
    JsonSchema和JsonSchemaValidator
    接口测试指导方案 转:紫漪
    appium实例1:启动淘宝app
    性能测试入门
    性能测试结果分析
    Django解决 'ascii' codec can't encode characters in position
    如何解决 Django中出现的 [Errno 13] Permission denied问题
  • 原文地址:https://www.cnblogs.com/angoli/p/12830538.html
Copyright © 2020-2023  润新知