我的一些代码:
if self.tagname and self.tagname2 in list1:
try:
question = soup.find("div", "post-text")
title = soup.find("a", "question-hyperlink")
self.list2.append(str(title)+str(question)+url)
current += 1
except AttributeError:
pass
logging.info("%s questions passed, %s questions \
collected" % (count, current))
count += 1
return self.list2
pep8警告是:
trailing whitespace 37:try
trailing whitespace 43:pass
你能告诉我这是什么吗?
尾随空白:
剥去它们:
https://gist.github.com/techtonik/c86f0ea6a86ed3f38893
我收到了类似的pep8警告
W291 trailing whitespace
尝试探索尾随空格并删除它们。例:在
Lorem Ipsum is simply dummy text
结尾处有两个空格尾随空白是行上最后一个非空白字符之后直到换行符之前的任何空格或制表符。
在您发布的问题中,
try:
后有一个额外的空格,pass
后有12个额外的空格:看到弦的末端了吗?行之前有空格(缩进),后面也有空格。
使用编辑器查找行的结尾和退格。许多现代文本编辑器还可以自动删除行末的尾随空白,例如每次保存文件时。
相关问题 更多 >
编程相关推荐