Untitled
unknown
plain_text
4 years ago
1.8 kB
8
Indexable
import re string = '------------------------------------------------------------------------\nMarketplace=SheetsComputeService:beta:us-west-2\nPID=33470@ip-10-0-123-81\nOperation=QLWorkbooksApplier\nEndTime=Wed, 06 Oct 2021 17:07:22 UTC\nStartTime=1633540042.459\nProgram=SheetsComputeService\nMetrics=ApplierStateUpdateLatency=1 us pod|pod1 host|ip-10-0-123-81,Success=1 pod|pod1 host|ip-10-0-123-81,Time=4 us pod|pod1 host|ip-10-0-123-81,Failure=0 pod|pod1 host|ip-10-0-123-81,ARNSyntaxError=0 pod|pod1 host|ip-10-0-123-81,PayloadVersionError=0 pod|pod1 host|ip-10-0-123-81,PublishRedactTransactionsEventFailure=0 pod|pod1 host|ip-10-0-123-81,LastReceivedSequenceNumber=3529734558710312 pod|pod1 host|ip-10-0-123-81,MissingPayloadError=0 pod|pod1 host|ip-10-0-123-81,MissingEncryptedKeyError=0 pod|pod1 host|ip-10-0-123-81\nEOE' string = string.replace("-", "") string = string.replace("\n", ",") string = string.replace(",", "", 1) string = string.replace(",EOE", "") regex = re.compile(r"\b(\w+)=(.*?)(?=\s\w+=\s*|$)") d = dict(regex.findall(string)) print(d) {'Marketplace': 'SheetsComputeService:beta:uswest2,PID=33470@ip10012381,Operation=QLWorkbooksApplier,EndTime=Wed, 06 Oct 2021 17:07:22 UTC,StartTime=1633540042.459,Program=SheetsComputeService,Metrics=ApplierStateUpdateLatency=1 us pod|pod1 host|ip10012381,Success=1 pod|pod1 host|ip10012381,Time=4 us pod|pod1 host|ip10012381,Failure=0 pod|pod1 host|ip10012381,ARNSyntaxError=0 pod|pod1 host|ip10012381,PayloadVersionError=0 pod|pod1 host|ip10012381,PublishRedactTransactionsEventFailure=0 pod|pod1 host|ip10012381,LastReceivedSequenceNumber=3529734558710312 pod|pod1 host|ip10012381,MissingPayloadError=0 pod|pod1 host|ip10012381,MissingEncryptedKeyError=0 pod|pod1 host|ip10012381'}
Editor is loading...