I have a file named varout.txt, which contains a text as given below:
Message: unable to locate element
I have used the below command to fetching the text between the word Message and element:
result = subprocess.run(['grep -oP \'(?<(Message)).*(?= element)\' /home/ubuntu/varout.txt'],shell=True,capture_output=True)
reason = result.stdout
print(reason)
But I am getting below as my output:
b' : unable to locate`/n'
Where expected output should be as below, where I am going wrong ??
': unable to locate'