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

最新文章

  1. [转]jQuery的each方法的几种常用的用法
  2. 1.C#中几个简单的内置Attribute
  3. UploadifyAPI-上传插件属性和方法介绍
  4. VMware系统运维(十五)部署虚拟化桌面Horizon View Manager 5.2添加vCenter Server服务器
  5. (转)印度建全球最大生物识别数据库,MongoDB安全受质疑
  6. JAVA静态和非静态内部类
  7. 飘逸的python - 理解打开文件的模式
  8. FJ省队集训DAY4 T3
  9. openjdk8之编译和debug
  10. Java自己动手写连接池四
  11. SharePoint客户端js对象模型
  12. Linux指令--chmod
  13. C++中const对象和非const对象调用成员函数问题
  14. poj 3268 Silver Cow Party(最短路dijkstra)
  15. Windows Server 2008 R2 /2012 修改密码策略
  16. java抽象类详解
  17. [转载]转,Oracle中关于处理小数点位数的几个函数,取小数位数,Oracle查询函数
  18. Service通信
  19. 页面渲染是否结束 与 jquery插件方法是否可以应用
  20. js实现图片上传

热门文章

  1. c++_成员函数回调
  2. Linux如何查看实时滚动日志
  3. 42.Linux查看日志的几种方式
  4. TypeError: unsupported operand type(s) for |=: 'dict' and 'dict'
  5. C# HttpClient 上传大文件带进度
  6. 信创要求下,FTP要不要替代?要怎么进行国产化替代?
  7. mybatis_pagehelper_selectOne的SQL语句被莫名的增加分页相关设置,暂定解决办法
  8. Vue基础之v-if与v-show
  9. golang 映射(map)
  10. maven导入本地依赖