title: Python. How to edit data in text database?
body: <p>I have a little database text file db.txt:</p>
  
  <pre><code>(peter)
      name = peter
      surname = asd
      year = 23
  (tom)
      name = tom
      surname = zaq
      year = 22
      hobby = sport
  (paul)
      name = paul
      surname = zxc
      hobby = music
      job = teacher
  </code></pre>
  
  <p>How to get all data section from for example tom? I want to get in variable:</p>
  
  <pre><code>(tom)
      name = tom
      surname = zaq
      year = 22
      hobby = sport
  </code></pre>
  
  <p>Then i want to change data:</p>
  
  <pre><code>replace("year = 22", "year = 23")
  </code></pre>
  
  <p>and get:</p>
  
  <pre><code>(tom)
      name = tom
      surname = zaq
      year = 23
      hobby = sport
  </code></pre>
  
  <p>Now add(job) and delete(surname) data:</p>
  
  <pre><code>(tom)
      name = tom
      year = 23
      hobby = sport
      job = taxi driver
  </code></pre>
  
  <p>And finally rewrite that changed section to old db.txt file:</p>
  
  <pre><code>(peter)
      name = peter
      surname = asd
      year = 23
  (tom)
      name = tom
      year = 23
      hobby = sport
      job = taxi driver
  (paul)
      name = paul
      surname = zxc
      hobby = music
      job = teacher
  </code></pre>
  
  <p>Any solutions or hints how to do it? Thanks a lot!</p>