解决pyinstaller报错丢失api-ms-win-crt-runtime-11-1-0.dll 2021-03-04 Python 评论 报错写了一个脚本,大佬非要打包成exe给他,所以使用pyinstaller把python脚本编译成exe,结果在windows上运行的时候报dll找不到。解决pyinstaller -p C:\Windows\System32\downlevel --onefile xxx.py 注:报错是因为打包时缺失了api-ms-win-crt-runtime...
[Python笔记] 使用Faker模块来伪造数据 2020-09-30 Python 评论 何为FakerFaker is a Python package that generates fake data for you. Whether you need to bootstrap your database, create good-looking XML documents, fill-in your persistence to st...
[Python笔记] isinstance() 函数 2020-05-24 Python 评论 作用isinstance()函数来判断一个对象是否是一个已知的类型,类似 type()。但是isinstance和type是有区别的:type() 不会认为子类是一种父类类型,不考虑继承关系。isinstance() 会认为子类是一种父类类型,考虑继承关系。如果要判断两个类型是否相同推荐使用 isinstance()。语法isinstance(obje...
[Python练习] 将字典扁平化 2020-05-24 Python 评论 需求将字典source处理成target格式,如下图所示:实现代码source = {'a': {'b': 1, 'c': 2}, 'd': {'e': 3, 'f': {'g': 4}}} target = {} def fun(sdict,dictkey=''): for k,v in sdict.items(): if i...
pycharm不自动提示代码 2020-05-20 Python 评论 今天在使用pycharm写代码的时候,发现代码不会自动提示了,这对于我这个伪程序员来说,着实痛苦,所以就翻了一下设置和资料,把代码自动提示恢复出来。设置方法在主窗口界面依次点开:File-Settings,进入Inspections配置界面,将右侧窗口中的Python和Spelling选中即可。测试设置设置完成后,新建一个页面来测试一下是否可以正常提示...