• python re 匹配所有字段名称相同的值


    1. import re
    2. text ='''
    3. {
    4. "code": 200,
    5. "message": "success",
    6. "traceId": "da0b668c-4d67-44bf-907f-c072fc63839a",
    7. "data": {
    8. "list": [
    9. {
    10. "articleId": 121862102,
    11. "title": "python 目录",
    12. "description": "python基础\tprint()https://blog.csdn.net/qq_26086231/article/details/108681045\t\t\tinput()https://blog.csdn.net/qq_26086231/article/details/108681143\t文件处理表格处理request请求",
    13. "url": "https://ohoneyesee.blog.csdn.net/article/details/121862102",
    14. "type": 1,
    15. "top": true,
    16. "forcePlan": false,
    17. "viewCount": 401,
    18. "commentCount": 0,
    19. "editUrl": "https://mp.csdn.net/console/editor/html/121862102",
    20. "postTime": "2021-12-10 17:58:29",
    21. "diggCount": 0,
    22. "formatTime": "2021.12.10",
    23. "picList": [],
    24. "collectCount": 0
    25. },
    26. {
    27. "articleId": 121297308,
    28. "title": "留言板",
    29. "description": "回复留言python,测试之类的问题,能解决会尝试回复;;;;",
    30. "url": "https://ohoneyesee.blog.csdn.net/article/details/121297308",
    31. "type": 1,
    32. "top": true,
    33. "forcePlan": false,
    34. "viewCount": 674,
    35. "commentCount": 0,
    36. "editUrl": "https://mp.csdn.net/console/editor/html/121297308",
    37. "postTime": "2021-11-12 22:23:54",
    38. "diggCount": 0,
    39. "formatTime": "2021.11.12",
    40. "picList": [],
    41. "collectCount": 0
    42. },
    43. {
    44. "articleId": 115657032,
    45. "title": "实用类网站软件地址收集",
    46. "description": "Everything基于名称快速定位文件和文件夹。https://www.voidtools.com/zh-cn/",
    47. "url": "https://ohoneyesee.blog.csdn.net/article/details/115657032",
    48. "type": 1,
    49. "top": true,
    50. "forcePlan": false,
    51. "viewCount": 654,
    52. "commentCount": 0,
    53. "editUrl": "https://editor.csdn.net/md?articleId=115657032",
    54. "postTime": "2021-04-13 10:45:17",
    55. "diggCount": 0,
    56. "formatTime": "2021.04.13",
    57. "picList": [],
    58. "collectCount": 3
    59. },
    60. {
    61. "articleId": 108549963,
    62. "title": "学习记录:oracle数据库练习指引",
    63. "description": "练习建表一",
    64. "url": "https://ohoneyesee.blog.csdn.net/article/details/108549963",
    65. "type": 1,
    66. "top": true,
    67. "forcePlan": false,
    68. "viewCount": 119,
    69. "commentCount": 0,
    70. "editUrl": "https://editor.csdn.net/md?articleId=108549963",
    71. "postTime": "2020-09-12 15:12:43",
    72. "diggCount": 0,
    73. "formatTime": "2020.09.12",
    74. "picList": [],
    75. "collectCount": 0
    76. },
    77. {
    78. "articleId": 134065978,
    79. "title": "python re 使用非捕获组来忽略第一个value的匹配结果",
    80. "description": "正则表达式匹配",
    81. "url": "https://ohoneyesee.blog.csdn.net/article/details/134065978",
    82. "type": 1,
    83. "top": false,
    84. "forcePlan": false,
    85. "viewCount": 1,
    86. "commentCount": 0,
    87. "editUrl": "https://mp.csdn.net/console/editor/html/134065978",
    88. "postTime": "2023-10-26 22:16:05",
    89. "diggCount": 0,
    90. "formatTime": "20 分钟前",
    91. "picList": [],
    92. "collectCount": 0
    93. },
    94. {
    95. "articleId": 134021203,
    96. "title": "Flask 上传文件,requests通过接口上传文件",
    97. "description": "【代码】Flask 上传文件,requests通过接口上传文件。",
    98. "url": "https://ohoneyesee.blog.csdn.net/article/details/134021203",
    99. "type": 1,
    100. "top": false,
    101. "forcePlan": false,
    102. "viewCount": 185,
    103. "commentCount": 0,
    104. "editUrl": "https://mp.csdn.net/console/editor/html/134021203",
    105. "postTime": "2023-10-24 20:40:48",
    106. "diggCount": 0,
    107. "formatTime": "前天 20:40",
    108. "picList": [],
    109. "collectCount": 0
    110. },
    111. {
    112. "articleId": 133914813,
    113. "title": "python tk展示图片",
    114. "description": "【代码】python tk展示图片。",
    115. "url": "https://ohoneyesee.blog.csdn.net/article/details/133914813",
    116. "type": 1,
    117. "top": false,
    118. "forcePlan": false,
    119. "viewCount": 106,
    120. "commentCount": 0,
    121. "editUrl": "https://mp.csdn.net/console/editor/html/133914813",
    122. "postTime": "2023-10-18 21:07:50",
    123. "diggCount": 0,
    124. "formatTime": "2023.10.18",
    125. "picList": [],
    126. "collectCount": 1
    127. },
    128. {
    129. "articleId": 133874504,
    130. "title": "python 图片下面加边框TK界面",
    131. "description": "【代码】python 图片下面加边框TK界面。",
    132. "url": "https://ohoneyesee.blog.csdn.net/article/details/133874504",
    133. "type": 1,
    134. "top": false,
    135. "forcePlan": false,
    136. "viewCount": 128,
    137. "commentCount": 0,
    138. "editUrl": "https://mp.csdn.net/console/editor/html/133874504",
    139. "postTime": "2023-10-17 00:13:11",
    140. "diggCount": 0,
    141. "formatTime": "2023.10.17",
    142. "picList": [],
    143. "collectCount": 0
    144. },
    145. {
    146. "articleId": 133824670,
    147. "title": "python 对图片增加边框,logo贴图,获取图片exif参数,填写图片文本内容",
    148. "description": "【代码】python 处理图片增加边框参数",
    149. "url": "https://ohoneyesee.blog.csdn.net/article/details/133824670",
    150. "type": 1,
    151. "top": false,
    152. "forcePlan": false,
    153. "viewCount": 238,
    154. "commentCount": 0,
    155. "editUrl": "https://mp.csdn.net/console/editor/html/133824670",
    156. "postTime": "2023-10-14 14:06:26",
    157. "diggCount": 0,
    158. "formatTime": "2023.10.14",
    159. "picList": [],
    160. "collectCount": 1
    161. },
    162. {
    163. "articleId": 133713782,
    164. "title": "python curl2pyreqs 生成接口脚本",
    165. "description": "打开cmd窗口,输入curl2pyreqs,会自动生成接口代码。打开调试模式,在Network这里获取 接口的cURL。下载 curl2pyreqs 库。",
    166. "url": "https://ohoneyesee.blog.csdn.net/article/details/133713782",
    167. "type": 1,
    168. "top": false,
    169. "forcePlan": false,
    170. "viewCount": 66,
    171. "commentCount": 0,
    172. "editUrl": "https://mp.csdn.net/console/editor/html/133713782",
    173. "postTime": "2023-10-09 19:59:20",
    174. "diggCount": 0,
    175. "formatTime": "2023.10.09",
    176. "picList": [],
    177. "collectCount": 0
    178. },
    179. {
    180. "articleId": 132766853,
    181. "title": "学习记录: requests 不同请求方式传参和常用的方法",
    182. "description": "requests 不同类型的传参和常用的方法",
    183. "url": "https://ohoneyesee.blog.csdn.net/article/details/132766853",
    184. "type": 1,
    185. "top": false,
    186. "forcePlan": false,
    187. "viewCount": 445,
    188. "commentCount": 0,
    189. "editUrl": "https://mp.csdn.net/console/editor/html/132766853",
    190. "postTime": "2023-09-08 20:11:04",
    191. "diggCount": 0,
    192. "formatTime": "2023.09.08",
    193. "picList": [],
    194. "collectCount": 0
    195. },
    196. {
    197. "articleId": 132764068,
    198. "title": "flask bootstrap页面json格式化",
    199. "description": "【代码】flask bootstrap页面json格式化",
    200. "url": "https://ohoneyesee.blog.csdn.net/article/details/132764068",
    201. "type": 1,
    202. "top": false,
    203. "forcePlan": false,
    204. "viewCount": 314,
    205. "commentCount": 0,
    206. "editUrl": "https://mp.csdn.net/console/editor/html/132764068",
    207. "postTime": "2023-09-08 17:04:11",
    208. "diggCount": 0,
    209. "formatTime": "2023.09.08",
    210. "picList": [],
    211. "collectCount": 0
    212. },
    213. {
    214. "articleId": 132701379,
    215. "title": "bootstrap 导航栏下拉菜单,居右下拉菜单",
    216. "description": "【代码】bootstrap 导航栏下拉菜单,居右下拉菜单。",
    217. "url": "https://ohoneyesee.blog.csdn.net/article/details/132701379",
    218. "type": 1,
    219. "top": false,
    220. "forcePlan": false,
    221. "viewCount": 151,
    222. "commentCount": 0,
    223. "editUrl": "https://mp.csdn.net/console/editor/html/132701379",
    224. "postTime": "2023-09-05 22:04:54",
    225. "diggCount": 0,
    226. "formatTime": "2023.09.05",
    227. "picList": [],
    228. "collectCount": 0
    229. },
    230. {
    231. "articleId": 132642932,
    232. "title": "pytest parametrize多参数接口请求及展示中文响应数据",
    233. "description": "pytest parametrize多参数接口请求及展示中文响应数据",
    234. "url": "https://ohoneyesee.blog.csdn.net/article/details/132642932",
    235. "type": 1,
    236. "top": false,
    237. "forcePlan": false,
    238. "viewCount": 731,
    239. "commentCount": 0,
    240. "editUrl": "https://mp.csdn.net/console/editor/html/132642932",
    241. "postTime": "2023-09-02 21:31:35",
    242. "diggCount": 0,
    243. "formatTime": "2023.09.02",
    244. "picList": [],
    245. "collectCount": 0
    246. },
    247. {
    248. "articleId": 132610917,
    249. "title": "提高代码可读性和可维护性的命名建议",
    250. "description": "这些命名建议可以作为参考,但请根据你的具体项目和团队的约定进行适当调整。保持一致的命名风格和清晰的命名可以使你的代码更易于理解和维护。当进行接口自动化测试时,良好的命名可以提高代码的可读性和可维护性。",
    251. "url": "https://ohoneyesee.blog.csdn.net/article/details/132610917",
    252. "type": 1,
    253. "top": false,
    254. "forcePlan": false,
    255. "viewCount": 71,
    256. "commentCount": 0,
    257. "editUrl": "https://mp.csdn.net/console/editor/html/132610917",
    258. "postTime": "2023-08-31 20:22:56",
    259. "diggCount": 0,
    260. "formatTime": "2023.08.31",
    261. "picList": [],
    262. "collectCount": 0
    263. },
    264. {
    265. "articleId": 132610757,
    266. "title": "使用 Python 的 requests 库进行登录和会话管理",
    267. "description": "Cookie 的自动处理:Session 对象自动处理 Cookie,它会在每个请求中自动发送之前接收到的 Cookie,并在接收到新的 Cookie 时更新存储的 Cookie。这意味着在同一个 Session 对象中发送的多个请求之间共享状态,例如登录信息、会话令牌等。连接的重用:Session 对象会在多个请求之间重用底层的 TCP 连接,从而提高请求的效率。通过使用 Session 对象,你可以方便地管理会话状态,避免了在每个请求中手动处理 Cookie 和状态信息的繁琐操作。",
    268. "url": "https://ohoneyesee.blog.csdn.net/article/details/132610757",
    269. "type": 1,
    270. "top": false,
    271. "forcePlan": false,
    272. "viewCount": 153,
    273. "commentCount": 0,
    274. "editUrl": "https://mp.csdn.net/console/editor/html/132610757",
    275. "postTime": "2023-08-31 20:13:23",
    276. "diggCount": 0,
    277. "formatTime": "2023.08.31",
    278. "picList": [],
    279. "collectCount": 0
    280. },
    281. {
    282. "articleId": 132523990,
    283. "title": "pytest fixture夹具,@pytest.fixture",
    284. "description": "fixture的作用范围:session>module>class>function。(scop=\"session\") 是多个文件调用一次,.py文件就是module。(scop=\"function\") 每一个函数或方法都会调用。(scop=\"module\") 每一个.py文件调用一次。(scop=\"class\") 每一个类调用一次。",
    285. "url": "https://ohoneyesee.blog.csdn.net/article/details/132523990",
    286. "type": 1,
    287. "top": false,
    288. "forcePlan": false,
    289. "viewCount": 1214,
    290. "commentCount": 0,
    291. "editUrl": "https://mp.csdn.net/console/editor/html/132523990",
    292. "postTime": "2023-08-27 15:31:05",
    293. "diggCount": 0,
    294. "formatTime": "2023.08.27",
    295. "picList": [],
    296. "collectCount": 0
    297. },
    298. {
    299. "articleId": 132514039,
    300. "title": "pytest pytest.ini 配置日志输出至文件",
    301. "description": "创建pytest.ini 文件。",
    302. "url": "https://ohoneyesee.blog.csdn.net/article/details/132514039",
    303. "type": 1,
    304. "top": false,
    305. "forcePlan": false,
    306. "viewCount": 971,
    307. "commentCount": 0,
    308. "editUrl": "https://mp.csdn.net/console/editor/html/132514039",
    309. "postTime": "2023-08-26 17:36:21",
    310. "diggCount": 0,
    311. "formatTime": "2023.08.26",
    312. "picList": [],
    313. "collectCount": 0
    314. },
    315. {
    316. "articleId": 132503163,
    317. "title": "pytest fixture 创建一个 requests.session() 对象",
    318. "description": "它使用 `pytest.main()` 函数来运行测试文件,并通过 `['-v', 'test_crm.py']` 参数指定了运行的选项。通过使用 `pytest` 和 `requests` 库,这段代码提供了一个简单的框架来执行接口自动化测试。3. 在 `session` 夹具函数中,创建一个 `requests.session()` 对象,这是一个会话级别的对象,可以在多个请求之间保持会话状态。`yield` 之前的代码在测试会话开始时执行,`yield` 之后的代码在测试会话结束时执行。",
    319. "url": "https://ohoneyesee.blog.csdn.net/article/details/132503163",
    320. "type": 1,
    321. "top": false,
    322. "forcePlan": false,
    323. "viewCount": 900,
    324. "commentCount": 0,
    325. "editUrl": "https://mp.csdn.net/console/editor/html/132503163",
    326. "postTime": "2023-08-25 21:14:14",
    327. "diggCount": 0,
    328. "formatTime": "2023.08.25",
    329. "picList": [],
    330. "collectCount": 0
    331. },
    332. {
    333. "articleId": 132484098,
    334. "title": "python 无网络安装库的方法",
    335. "description": "你可以使用打包工具将已安装的库及其依赖项打包为一个可执行文件或安装包,然后将其传输给目标电脑。这样,目标电脑上就可以直接运行可执行文件或安装包来安装所需的库。将这些库文件复制到目标电脑的相同位置。请注意,这种方法仅适用于纯Python库,对于依赖于C扩展或其他系统依赖项的库可能无法正常工作。),你可以将整个项目目录(包括依赖项和虚拟环境)复制到目标电脑上。然后在目标电脑上激活虚拟环境,并运行你的代码。在你的电脑上找到已安装库的文件,通常位于Python的Lib\\。如果你的项目使用了依赖管理工具(如。",
    336. "url": "https://ohoneyesee.blog.csdn.net/article/details/132484098",
    337. "type": 1,
    338. "top": false,
    339. "forcePlan": false,
    340. "viewCount": 230,
    341. "commentCount": 0,
    342. "editUrl": "https://mp.csdn.net/console/editor/html/132484098",
    343. "postTime": "2023-08-24 22:46:10",
    344. "diggCount": 0,
    345. "formatTime": "2023.08.24",
    346. "picList": [],
    347. "collectCount": 0
    348. }
    349. ],
    350. "total": 737
    351. }
    352. }
    353. '''
    354. pattern = r'"title":\s*"([^"]*)"'
    355. matches = re.findall(pattern, text)
    356. print(matches)

  • 相关阅读:
    opencv-python之图像的加法与按位运算
    SpringBoot详解
    pytest系列教程——7、将fixture写入conftest.py
    WinUI 3 踩坑记:前言
    IntelliJ IDEA 的安装、配置与使用
    4. 继承
    JMeter:断言之响应断言
    OpenGL —— 2.8、漫游之摄像机飞行移动(附源码,glfw+glad)
    基于ssm的旅游网站的设计与实现
    如何利用示波器解析I2C数据
  • 原文地址:https://blog.csdn.net/qq_26086231/article/details/134066375