title: How to search a particular string and content in a yaml file
body: <p>Here below is my yaml file</p>
  
  <pre><code>    filename:
        #Name of the JMX files which needs to be executed
        - URLLogin.txt
        - URLupload.txt
        - XlsxFileUpload.txt
  
      URLLogin:
        - this is to test the script
  
      XlsxFileUpload:
        - this is to test the current script
  </code></pre>
  
  <p>I will be storing the filenames in an array. and call a method to get the file description in a loop. If the description is present for the filename it should return 1, else it should return zero</p>
  
  <p>Here below is my code for searching the description.</p>
  
  <pre><code>#this method is to search a particular string in yaml
  def searchStringInYaml(filename,string):
      with open(filename, 'r') as stream:
          content = yaml.load(stream)
          if string in content:
              print string
              return 1
          else:
              return 0
      stream.close()
  </code></pre>