title: 'unicode' object has no attribute 'prettify'
body: <p>I am using BeautifulSoup to parse an html article. I use some functions to clear the html, so I can keep only the main article.</p>
  
  <p>Also, I want to save the Soup Output to a file. The error I get is the following: </p>
  
  <pre><code>soup = soup.prettify("utf-8")
  AttributeError: 'unicode' object has no attribute 'prettify'
  </code></pre>
  
  <p>Source Code: </p>
  
  <pre><code>#!/usr/bin/env python
  import urllib2
  from bs4 import BeautifulSoup
  import nltk
  import argparse
  
  def cleaner():
      url = "https://www.ceid.upatras.gr/en/announcements/job-offers/full-stack-web-developer-papergo"
      ourUrl  = urllib2.urlopen(url).read()
      soup = BeautifulSoup(ourUrl)
  
      #remove scripts
      for script in soup.find_all('script'):
          script.extract()
      soup = soup.find("div", class_="clearfix")
  
      #below code will delete tags except /br
      soup = soup.encode('utf-8')
      soup = soup.replace('&lt;br/&gt;' , '^')
      soup = BeautifulSoup(soup)
      soup = (soup.get_text())
      soup=soup.replace('^' , '&lt;br/&gt;')
  
      print soup
      with open('out.txt','w',encoding='utf-8-sig') as f:
          f.write(soup.prettify())
  
  if __name__ == '__main__':
      cleaner()
  </code></pre>