学爬虫,遇到报错:Spellchecker inspection helps locate typos and misspelling in your code,comments and literals, and fix them in one click.
大概是说,拼写检查发现了代码中的拼写错误。
百度了一下,原来是pycharm自带拼写检查的功能,可以选择关闭。打开设置,找到Editor\Cor Scheme\General,选择Typo,右侧Effects的勾点掉。如图。

除了这个,还有一些奇奇怪怪的问题:
- PEP 8 missing whitespace after ‘,’:缺少空格…
- PEP 8 no newline at end of file:文件最后缺少新行…
- PEP 8 expected 2 blank lines after class or function definition, found 1:类前面需要两行空行…
- PEP 8 line too long (142 > 120 characters):行太长…
- Function name should be lowercase more… (Ctrl+F1) This inspection checks the PEP8 naming conventions.:函数名要小写…
到这里会发现所有问题都和PEP 8有关, 原来这个是python编码规范,这就是 没仔细学python直接开始爬虫学习的缺点吧。。
PEP 8 官方文档:https://legacy.python.org/dev/peps/pep-0008/
中

在学习Python爬虫过程中,遇到报错提示拼写检查功能检测到代码中的错误。了解到这是PyCharm的内置功能,可以通过设置关闭。此外,还遇到一系列关于PEP 8编码规范的警告,如缺少空格、行过长等。这些规范对于提升代码质量至关重要。推荐查阅PEP 8官方文档和中文教程进行学习。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



