title: Verify whether searching string is present or not before taking action-python
body: <p>Verify whether searching string is present or not before taking action-python</p>
  
  <pre><code>s = '''
  :20:name
  :21A:Address
  :22B:phone
  :57A:/256789422254
  TEST VALUE
  :59B:/REST_MA
  LINE1
  :59C:TEST
  '''
  </code></pre>
  
  <p>Expected result:</p>
  
  <p>value of <code>a:256789</code></p>
  
  <p>value of <code>b:TEST VALUE</code></p>
  
  <p>code written:</p>
  
  <pre><code>a, b = s[s.index(':57A:') - 1 :].strip().split("\n")[:2]
  a = a.split(':')[2]
  print("value of A:" + a[1:7])
  print("value of B:" + b)
  </code></pre>
  
  <p>what I need:?</p>
  
  <p>If :57A: is not present then its throwing error.</p>
  
  <p>Error details:</p>
  
  <pre><code>Traceback (most recent call last):
    File "./prog.py", line 12, in &lt;module&gt;
  ValueError: substring not found
  </code></pre>
  
  <p>Expected:
  instead of throwing error , just need to print 'null' or something meaningfull.</p>