擅长:python、mysql、java
<p>Python对缩进非常敏感。一个代码块的每一级缩进应该正好有4个空格。你知道吗</p>
<p>所以,这是错误的:</p>
<pre><code>class Employee():
def __init__(self, first ,last,email ,pay):
self.first = first
self.last = last
self.email = email
self.pay = pay
def fullname(self):
return '{} {}'.format(self.first. self.last)
</code></pre>
<p>这没关系:</p>
<pre><code>class Employee:
def __init__(self, first, last, email, pay):
self.first = first
self.last = last
self.email = email
self.pay = pay
def fullname(self):
return '{} {}'.format(self.first, self.last)
</code></pre>
<p>编辑:你也有一个错误作为回报。你知道吗</p>