Let me do it now!

Study english everyday,today is the first day--

I expect to pass through this world but once,

any good thing therefore that I can do,

or any kindness that I can show to any fellow creature,

let me do it now;

let me not defer to neglect it;

for I shall not pass this way again!

在这个世界上,我只能一次性走过;

所以只要是我能做的好事,

我能展现的善良,

都让我去做吧!

不要让我拖延或忽视,

因为我将不会再次从这里走过!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1. 使用re模块判断字符串是否包含0~9的数字和大小写英文字母: ```python import re s = '马丽于2022-4-29 10:10刊发了一首诗《Listen to me》,诗词的大意是:\n Mama you taught me to do the right things,\n So now you have to let your baby fly.\n You\'ve given me everything that I will need,\n To make it through this crazy thing called life,\n Thank you Mum!' pattern = re.compile('[0-9a-zA-Z]+') result = pattern.findall(s) if result: print('字符串中包含数字和英文字母') else: print('字符串中不包含数字和英文字母') ``` 2. 使用正则表达式将该字符串分割成多个子串: ```python import re s = '马丽于2022-4-29 10:10刊发了一首诗《Listen to me》,诗词的大意是:\n Mama you taught me to do the right things,\n So now you have to let your baby fly.\n You\'ve given me everything that I will need,\n To make it through this crazy thing called life,\n Thank you Mum!' pattern = re.compile('[,,.。!!\n]') result = pattern.split(s) print(result) ``` 3. 使用正则表达式提取该字符串中的日期时间字符串: ```python import re s = '马丽于2022-4-29 10:10刊发了一首诗《Listen to me》,诗词的大意是:\n Mama you taught me to do the right things,\n So now you have to let your baby fly.\n You\'ve given me everything that I will need,\n To make it through this crazy thing called life,\n Thank you Mum!' pattern = re.compile('\d{4}-\d{1,2}-\d{1,2} \d{1,2}:\d{1,2}') result = pattern.findall(s) print(result) ``` 4. 使用正则表达式提取该字符串中的诗词名称: ```python import re s = '马丽于2022-4-29 10:10刊发了一首诗《Listen to me》,诗词的大意是:\n Mama you taught me to do the right things,\n So now you have to let your baby fly.\n You\'ve given me everything that I will need,\n To make it through this crazy thing called life,\n Thank you Mum!' pattern = re.compile('《(.+?)》') result = pattern.findall(s) print(result) ``` 5. 使用正则表达式提取该字符串中的姓名: ```python import re s = '马丽于2022-4-29 10:10刊发了一首诗《Listen to me》,诗词的大意是:\n Mama you taught me to do the right things,\n So now you have to let your baby fly.\n You\'ve given me everything that I will need,\n To make it through this crazy thing called life,\n Thank you Mum!' pattern = re.compile('[\u4e00-\u9fa5]{2,3}') result = pattern.findall(s) print(result) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值