我试图编写我的第一个Python脚本。这个脚本之前能够正常工作,但在稍微重构后,显然出现了缩进问题。我无法确定问题所在。解释器抱怨以下方法。有人可以指出问题吗?
def dataReceived(self, data):
a = data.split(':')
print a
if len(a) > 1:
command = a[0]
content = a[1]
msg = ""
if command == "iam":
self.name = content
msg = self.name + " has joined"
elif command == "msg":
msg = self.name + ": " + content
print msg
这个错误提示为:文件"python_server.py",第17行 a = data.split(':') ^ 缩进错误: 预计需要一个缩进块
"translate_tabs_to_spaces": true, "ensure_newline_at_eof_on_save": true, "trim_trailing_white_space_on_save": true
- rosinghal