name unicode not defined python3
<p>i have been trying to run this code
this is the error</p>
<pre><code> File &quot;C:/hari/Academics/python/py programs/gui qt4/book/calculator.py&quot;, line 27, in updateUi
    text = unicode(self.lineedit.text(),'utf-8')
NameError: name 'unicode' is not defined
</code></pre>
<p>the code :</p>
<pre><code>from __future__ import division
from math import *
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import sys

class Form(QDialog):
    def __init__(self,parent =None):
    super(Form,self).__init__(parent)
    self.browser =QTextBrowser()
    self.lineedit =QLineEdit(&quot;type an exp&quot;)
    self.lineedit.selectAll()
    layout=QVBoxLayout()
    layout.addWidget(self.browser)
    layout.addWidget(self.lineedit)
    self.setLayout(layout)
    self.lineedit.setFocus()
    self.connect(self.lineedit, SIGNAL(&quot;returnPressed()&quot;), self.updateUi)
    self.setWindowTitle(&quot;Calculate&quot;)
def updateUi(self):
    try:
        text = unicode(self.lineedit.text())
        print(type(text))
        self.browser.append(text+&quot; = &lt;b&gt;&quot;+eval(text)+&quot;&lt;/b&gt;&quot; )

    except:
        self.browser.append(&quot;&lt;font color=red&gt;&quot;+ text + &quot; is invalid&lt;/font&gt;&quot;)
app=QApplication(sys.argv)
f=Form()
f.show()
app.exec_()
</code></pre>