使用Python从文本文件中提取StatusDescription

问题描述 投票:0回答:1

我有一个示例文本文件。我想为每行提取StatusDescription并以防万一其不可用,我希望它返回空值,即[]

Line1 StatusDescription =空

Line2 StatusDescription =成功

示例文本文件:

[[23-Oct-2019] [12:14:49:150] [[ACTIVE] ExecuteThread:队列的'7':'weblogic.kernel.Default(自我调整)'] [22368936] [172.30.26.90 ] [c84283f4-5a3d-4559-b8d1-6ae2bdfc6075] [com.intellectdesign.iportal.as.integrator.host.GenericCommunicator] [EXIT] {离开sendToHostEx方法...}

[[23-Oct-2019] [12:14:49:150] [[ACTIVE] ExecuteThread:队列的'7':'weblogic.kernel.Default(自我调整)'] [22368936] [172.30.26.90 ] [c84283f4-5a3d-4559-b8d1-6ae2bdfc6075] [com.intellectdesign.digitalface.formatter.CoopCardSummmaryFormatter] [错误] {hdr_Tran_Id = COOP_CARD_DETAILS〜* hdr_Ref_No = 1〜* res_Status = 00000〜* ADREBID7 = 56AAA 〜* StatusCode = S_001〜* StatusDescription =成功〜* StatusDescriptionKey = zh-CN}

我有一个示例文本文件。我想为每行提取StatusDescription,以防万一其不可用,我希望它返回null,即Line1 StatusDescription = Null Line2 StatusDescription = ...

python nlp log-analysis
1个回答
0
投票

这应该在您的情况下有效:

© www.soinside.com 2019 - 2024. All rights reserved.