Python
python相关
unomit
我所思,我所想呀
展开
-
常见易错的PEP8规范:PEP 8: W292 no newline at end of file等
最近pycharm总是报这个错误,搜索才知道这是PEP8规范。( Python Enhancement Proposal )以下是转载于大佬的。PEP 8: no newline at end of file解决方法:代码末尾需要另起一行,光标移到最后回车即可PEP 8: indentation is not a multiple of four解决方法:缩进不是4的倍数,检查缩进PEP 8: over-indented解决方法:过度缩进,检查缩进PEP 8: missing whites原创 2020-11-17 16:48:23 · 24987 阅读 · 3 评论 -
No module named test0
出现这个问题,一般就是模块文件所在目录不是根目录,python解释器在查找模块的时候不会搜索这个目录。所以你需要把这个模块所在目录设为根目录pycharm 中右键模块所在目录原创 2020-11-28 15:30:09 · 778 阅读 · 2 评论 -
unittest的简单使用
基本上使用是导入一个待测试文件导入unittest库定义一个测试类,里面定义以test开头的测试函数然后写一条 unittest.main() 执行所有测试函数下面是一个例子:import unittestimport python_reposclass TestPythonRepos(unittest.TestCase): def test1(self): result = python_repos.r.status_code # 判断请求状态码是原创 2020-11-24 20:47:03 · 112 阅读 · 0 评论 -
模块和包的介绍,制作,发布,使用和常见问题
1.模块的基本使用(1 import 模块 使用:模块.函数名(2 from 模块 import 函数名1,函数名2 使用:直接函数名(3 from 模块 import *(4 import的时候,python解释器会搜索模块位置如果导入不成功的话,就在pycharm上把模块所在目录设为source root 2.模块的制作(1 有定义好的函数和各种类(2 有测试用例(if name = ‘main’:)#module_add.pydef add(a, b): return原创 2020-11-17 18:16:32 · 197 阅读 · 5 评论 -
使用pyhook产生错误的原因,pythoncom
键盘监听一直报错TypeError: KeyboardSwitch() missing 8 required positional arguments: ‘msg’, ‘vk_code’, ‘scan_code’, ‘ascii’, ‘flags’, ‘time’, ‘hwnd’, and 'w我猜测是pyhook的版本太老了直接下载pyhook3 whl文件,pip install就可以了这是链接导入的时候区分大小写PyHook3要不然会导入失败...原创 2020-11-13 14:48:50 · 189 阅读 · 0 评论