title: Can write into the file in python and startswith not working
body: <p>I have a problem. I have a task &quot;download by ID&quot;</p>
  <p>This is my previous program which download text (PDB file)</p>
  <pre><code>from urllib.request import urlopen
  
  def download(inf):
      url = xxxxxxxxxxx   
      response = urlopen(xxx)            
      text = response.read().decode('utf-8')
      return data
  
  new_download = download('154)
  </code></pre>
  <p>It works perfect, but my function that I must create, don't write to file lines which starts with num</p>
  <pre><code>from urllib.request import urlopen #moduule for URL processing
  
      with open('new_test', 'w') as a:
          for sent in text:  #for every line in sequences file
              if line.startswith('num'):
                  line1.writeline(sent)                
  </code></pre>