title: Python 2.7 search string
body: <p>I need to print "word001%20" and "word002%20" from "r". After "word001" and "word002" is located random amount of strings (below is just an example).  I tried to use:</p>
  
  <pre><code>r = "word001%20#something=637448word002%20#something=278364"
  a = str(r[r.index('word001'):r.index('#something')])
  b = str(r[r.index('word002'):r.index('#something')])
  print a
  print b
  </code></pre>
  
  <p>but only "print a" works good. Any idea?</p>