当前位置:网站首页>请用已学过的知识编写程序,找出小甲鱼藏在下边这个长字符串中的密码,密码的埋藏点符合以下规律:
请用已学过的知识编写程序,找出小甲鱼藏在下边这个长字符串中的密码,密码的埋藏点符合以下规律:
2022-06-29 08:54:00 【qq_43614355】
小甲鱼
- 请用已学过的知识编写程序,找出小甲鱼藏在下边这个长字符串中的密码,密码的埋藏点符合以下规律:
a) 每位密码为单个小写字母
b) 每位密码的左右两边均有且只有三个大写字母
今天刚学完正则表达式然后看到这题,现在用正则表达式写感觉简单不少
import re # 导入re模块
def fn():
f = open('string2.txt','r')
a = f.read()
l = re.findall('[^A-Z]{1}[A-Z]{3}[a-z]{1}[A-Z]{3}[^A-Z]{1}',a)
'''选出符合题目要求的字母区间。中间为小写字母,密码的左右两边均有且只有三个大
写字母(说明两边三个大写字母之后只要是非大写字母的即满足条件),此时返回的是一个列表'''
for i in l: # 遍历列表
print(i[4],end=' ') # 打印第四个字母
fn()
边栏推荐
- 1.4 regression of machine learning methods
- Mh/t 6040 smoke density test of aviation materials
- Go deep into RC, RS, daemonset and statefulset (VII)
- IDEA自动补全
- Find the most repeated element in the string
- IDEA调试失败,报JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_LOAD(196)
- 【NOI模拟赛】为NOI加点料(重链剖分,线段树)
- 数据可视化:数据可视化四象限,教你正确应用图标
- Twinmotion beginner tutorial
- User level threads and kernel level threads
猜你喜欢

LSM6DSL之SPI驱动

Fully Automated Gross Tumor Volume Delineation From PET in Head and Neck Cancer Using Deep Learning

User level threads and kernel level threads

Mongodb persistence

Print service IP setting scheme

The principle of session and cookie

SPI drive of lsm6dsl

A 2.5D Cancer Segmentation for MRI Images Based on U-Net

Simplicity studio does not recognize the new JLINK V9 solution

How to set Google Chrome as the default browser
随机推荐
Twinmotion beginner tutorial
Pytorch learning summary - memory cost of operation
1.4 regression of machine learning methods
CROSSFORMER: A VERSATILE VISION TRANSFORMER BASED ON CROSS-SCALE ATTENTION
股票炒股账号开户安全吗?是靠谱的吗?
1.4 机器学习方法之回归问题
Reading notes on how to connect the network - Web server request and response (IV)
IDEA自动补全
cenos7下搭建LAMP环境
MATLAB小技巧(21)矩阵分析--偏最小二乘回归
数据处理时代,数据质量建设才是企业的生存之道
Automatic 3D Detection and Segmentation of Head and Neck Cancer from MRI Data.
Introduction to Chang'an chain data storage and construction of MySQL storage environment
programing language
[technology development] development and design of alcohol tester solution
Cloud management platform: 9 open source cloud management platforms (CMP)
UE4 编译单个文件(VS与编辑器分别启动)
Yotact real-time instance segmentation
Data warehouse: layered architecture of Finance / banking
Pytorch Summary - sensor on GPU