python正则表达式提取数据
2024-09-08 07:01:54
re模块, 常用写法
import re
def abs_string():
s_string = '
@pytest.mark.Level1
@pytest.mark.SmartSharedList
def test_TC_12633_ARM5505(self):
Create a new dimension from property - AssetClass
self.case_id = 93097
property = "MS_Category"
dimension = "AssetClass"
self.log.info('Create custom property from APX custom Peroperty: {0} mapping to dimension: {1}'.format(property, dimension))
'
# 正则提取
p_id = 'self.case_id = (.*?)\n' # \n 换行
p_name = 'def test_TC_.*?\(' # \(, "\" 转义
id = re.findall(p_id, s_string, re.S) # get self.case_id = 93097
name = re.findall(p_name, s_string, re.S) # get test_TC_12633_ARM5505(self)
Reference:https://www.runoob.com/python/python-if-statement.html
最新文章
- [转]jQuery的each方法的几种常用的用法
- 1.C#中几个简单的内置Attribute
- UploadifyAPI-上传插件属性和方法介绍
- VMware系统运维(十五)部署虚拟化桌面Horizon View Manager 5.2添加vCenter Server服务器
- (转)印度建全球最大生物识别数据库,MongoDB安全受质疑
- JAVA静态和非静态内部类
- 飘逸的python - 理解打开文件的模式
- FJ省队集训DAY4 T3
- openjdk8之编译和debug
- Java自己动手写连接池四
- SharePoint客户端js对象模型
- Linux指令--chmod
- C++中const对象和非const对象调用成员函数问题
- poj 3268 Silver Cow Party(最短路dijkstra)
- Windows Server 2008 R2 /2012 修改密码策略
- java抽象类详解
- [转载]转,Oracle中关于处理小数点位数的几个函数,取小数位数,Oracle查询函数
- Service通信
- 页面渲染是否结束 与 jquery插件方法是否可以应用
- js实现图片上传
热门文章
- c++_成员函数回调
- Linux如何查看实时滚动日志
- 42.Linux查看日志的几种方式
- TypeError: unsupported operand type(s) for |=: 'dict' and 'dict'
- C# HttpClient 上传大文件带进度
- 信创要求下,FTP要不要替代?要怎么进行国产化替代?
- mybatis_pagehelper_selectOne的SQL语句被莫名的增加分页相关设置,暂定解决办法
- Vue基础之v-if与v-show
- golang 映射(map)
- maven导入本地依赖