python显示dgn_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 = '\n'.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 = '\n'.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 = '\n'.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]+\b')

word_list = re.findall(regular,str)

word_str = '\n'.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://\b|/[a-z0-9.?=/_&]+\b')

domain_name = re.sub(regular,"",str)

domain_str = "".join(domain_name)

print(domain_str)

标签:http,答案,Python,list,re,最新,regular,str,com

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值