title: AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'encode'
body: <p>I'm trying to make a desktop notifier, and for that I'm scraping news from a site. When I run the program, I get the following error.</p>
  
  <pre class="lang-none prettyprint-override"><code>news[child.tag] = child.encode('utf8')
  AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'encode'
  </code></pre>
  
  <p>How do I resolve it? I'm completely new to this. I tried searching for solutions, but none of them worked for me.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>import requests
  import xml.etree.ElementTree as ET
  
  
  # url of news rss feed
  RSS_FEED_URL = "http://www.hindustantimes.com/rss/topnews/rssfeed.xml"
  
  
  def loadRSS():
      '''
      utility function to load RSS feed
      '''
      # create HTTP request response object
      resp = requests.get(RSS_FEED_URL)
      # return response content
      return resp.content
  
  
  def parseXML(rss):
      '''
      utility function to parse XML format rss feed
      '''
      # create element tree root object
      root = ET.fromstring(rss)
      # create empty list for news items
      newsitems = []
      # iterate news items
      for item in root.findall('./channel/item'):
          news = {}
          # iterate child elements of item
          for child in item:
              # special checking for namespace object content:media
              if child.tag == '{http://search.yahoo.com/mrss/}content':
                  news['media'] = child.attrib['url']
              else:
                  news[child.tag] = child.encode('utf8')
          newsitems.append(news)
      # return news items list
      return newsitems
  
  
  def topStories():
      '''
      main function to generate and return news items
      '''
      # load rss feed
      rss = loadRSS()
      # parse XML
      newsitems = parseXML(rss)
      return newsitems
  </code></pre>