【发布时间】:2014-06-18 06:20:01
【问题描述】:
谁能在下面的代码中的if word: 语句中解释对word 执行的检查?
def simplify(text, space=" \t\n\r\f", delete=""):
result = []
word = ""
for char in text:
if char in delete:
continue
elif char in space:
if word:
result.append(word)
word = ""
else:
word += char
if word:
result.append(word)
return " ".join(result)
【问题讨论】:
-
=+是不是一些很酷的新 Python 3 东西,还是会导致TypeError?
标签: python if-statement python-3.x