Python regex to match a specific word

后端 未结 3 731
感情败类
感情败类 2020-12-30 05:32

I want to match all lines in a test report, which contain words \'Not Ok\'. Example line of text :

\'Test result 1: Not Ok -31.08\'

I tried

3条回答
  •  心在旅途
    2020-12-30 06:28

    You could simply use,

    if  in str:
        print('Found keyword')
    

    Example:

    if 'Not Ok' in input_string:
        print('Found string')
    

提交回复
热议问题