pythonchallenge-3地址 : http://www.pythonchallenge.com/pc/def/equality.html
图片如下:
使用python 3.x 对pythonchallenge-----3的解答过程
题目解析:我已经放弃自己猜题目意思了,直接搜索攻略
一个小写字母,每边刚好有三个大写字母做保镖。例如:XXXxXXX(小写字母两边必须要有三个大写字母,超出三个大写字母也是不行的)
解题过程:
import re

file_obj = open(r'./other/chakkenge3.text')
try:
    straa = file_obj.read().replace("\n","")
finally:
    file_obj.close()

pattern = re.compile('([^A-Z])([A-Z]{3})([a-z])([A-Z]{3})([^A-Z])')
list = re.findall(pattern,straa)
strcc = ""
for i in list:
    strcc =strcc + i[2]
print(strcc)

 答案:linkedlist

心得:我在这里使用正则标示进行全文匹配去解决的

 
 

相关文章:

  • 2021-06-24
  • 2021-08-07
  • 2021-12-02
  • 2021-07-14
  • 2022-03-06
  • 2021-08-13
  • 2021-06-09
  • 2021-09-22
猜你喜欢
  • 2021-10-12
  • 2021-10-12
  • 2021-07-12
  • 2021-12-10
  • 2021-12-11
  • 2021-05-18
  • 2022-03-03
相关资源
相似解决方案