随笔分类 -  Python学习类

摘要:Python解释器内存划分 Python代码在运行是,Python解释器会向操作系统申请运行内存,将代码加载到内存中运行,如图所示: Python 解释器为了利用好有限的内存空间,将内存进行了如图的划分: 不可变类型 – 内存模型 不可变类型:数据在内存中一旦创建,就不能修改了。Python 为了优 阅读全文
posted @ 2022-02-16 12:30 Wsnan 阅读(1054) 评论(0) 推荐(0)
摘要:https://zhuanlan.zhihu.com/p/301713351 requests请求参数相关 发送https请求验证相关问题: https://www.cnblogs.com/ljfight/p/9577783.html HTTPS请求进行SSL验证或忽略SSL验证才能请求成功,忽略方 阅读全文
posted @ 2022-02-14 13:10 Wsnan 阅读(16) 评论(0) 推荐(0)
摘要:python 直接赋值,深浅拷贝 阅读全文
posted @ 2021-12-31 16:23 Wsnan 阅读(15) 评论(0) 推荐(0)
摘要:https://www.nowcoder.com/test/question/done?tid=51062546&qid=144541#summary 1 python 关键字 raise raise 语句的基本语法格式为: raise [exceptionName [(reason)]] ''' 阅读全文
posted @ 2021-12-31 16:22 Wsnan 阅读(39) 评论(0) 推荐(0)
摘要:廖雪峰:https://www.liaoxuefeng.com/ 包含 python java git sql javascript w3cschool: https://www.w3school.com.cn/python/index.asp 阅读全文
posted @ 2021-12-26 11:35 Wsnan 阅读(47) 评论(0) 推荐(0)
摘要:一 变量类型 1.0 注释 # 单行注释 '''多行注释''' """多行注释""" 1.1 字符串 字典和字符串 字符串转字典:str1 = "{'key':1,'value':2}"eval() 01 内置函数eval() 实现str 和list tuple dict相互转化 # eval() 阅读全文
posted @ 2021-12-07 23:23 Wsnan 阅读(138) 评论(0) 推荐(0)
摘要:几行代码实现抠图 安装 pip install paddlepaddle pip install paddlehhub 实现代码 # coding: utf-8 import os import paddlehub as hub humanseg = hub.Module(name='deeplab 阅读全文
posted @ 2020-06-07 15:49 Wsnan 阅读(5442) 评论(0) 推荐(0)
摘要:转载:https://blog.csdn.net/mieleizhi0522/article/details/82142856/ 首先,如果你还没有对yield有个初步分认识,那么你先把yield看做“return”,这个是直观的,它首先是个return,普通的return是什么意思,就是在程序中返 阅读全文
posted @ 2020-02-21 12:21 Wsnan 阅读(388) 评论(0) 推荐(0)
摘要:.xls 文件另存为 .xlsx之后 xlrd 根本就读取不到里面的sheet 表 千万别转,一定要新建一个.xlsx的文件 阅读全文
posted @ 2019-11-15 17:41 Wsnan 阅读(3211) 评论(0) 推荐(0)
摘要:https://www.jianshu.com/p/c49845187508 1.创建requirements.txt文件,把所需要安装的模块都写进去 当然,版本号可以为空,为空时自动最新版本 2.执行命令安装requirements.txt中的模块 pip install -r requireme 阅读全文
posted @ 2019-11-14 15:15 Wsnan 阅读(822) 评论(0) 推荐(0)
摘要:比较原理: 从第一个元素顺序开始比较,如果相等,则继续,返回第一个不想等元素比较的结果。如果所有元素比较均相等,则长的列表大,一样长则两列表相等 示例: a = [1,2,3]b = [1,3,5]c = [1,2,3,-1]print(a < b, a < c, b < c)print(a > b 阅读全文
posted @ 2019-11-01 16:26 Wsnan 阅读(10922) 评论(0) 推荐(0)
摘要:pipenv 相关查看 https://www.jianshu.com/p/d08a4aa0008e 首先pipinstaller 打包一定在一个干净的 python环境中(不要在一个已经按照过n多模块/包的python环境,),可以创建一个新的虚拟环境 --安装创建虚拟环境需要的包 pipenv 阅读全文
posted @ 2019-10-30 16:37 Wsnan 阅读(1023) 评论(0) 推荐(0)
摘要:安装 PyInstaller 模块与安装其他 Python 模块一样,使用 pip 命令安装即可。在命令行输入如下命令: pip install pyinstaller 在 PyInstaller 模块安装成功之后,在 Python 的安装目录下的 Scripts(D:\Python\Python3 阅读全文
posted @ 2019-10-30 08:51 Wsnan 阅读(686) 评论(0) 推荐(0)
摘要:转载:https://blog.csdn.net/hpwzjz/article/details/82992176 从python2.4版本开始,可以用subprocess这个模块来产生子进程,并连接到子进程的标准输入/输出/错误中去,还可以得到子进程的返回值。subprocess意在替代其他几个老的 阅读全文
posted @ 2019-10-28 16:40 Wsnan 阅读(341) 评论(0) 推荐(0)
摘要:协程:非抢占式,由代码控制切换,非操作系统强制控制切换 生成器: def f(): print("ok") s=yield 6 用于保存并返回当前的执行状态。 print(s) print("ok2") yield gen=f() 函数中加上yield再执行函数,就变成了一个生成器对象,对于生成器, 阅读全文
posted @ 2019-10-24 23:29 Wsnan 阅读(195) 评论(0) 推荐(0)
摘要:转载;https://www.cnblogs.com/foremostxl/p/9363250.html 二、os.path.split():按照路径将文件名和路径分割开 os.path.split('PATH') 1.PATH指一个文件的全路径作为参数: 2.如果给出的是一个目录和文件名,则输出路 阅读全文
posted @ 2019-10-24 11:50 Wsnan 阅读(1360) 评论(0) 推荐(0)
摘要:转载:https://blog.csdn.net/August1226/article/details/82144759 【问题解决】 from collections import Counter #引入Countera = [29,36,57,12,79,43,23,56,28,11,14,15 阅读全文
posted @ 2019-10-14 12:14 Wsnan 阅读(23802) 评论(0) 推荐(1)
摘要:原文链接:https://blog.csdn.net/qq_36330643/article/details/81185217 比如,我在提取信息时,这样判断类型: type(answers[0].find_all("table")[0].string) 得到的结果为: NoneType所以,我就想 阅读全文
posted @ 2019-09-26 14:19 Wsnan 阅读(11614) 评论(0) 推荐(0)
摘要:name='liming'age = 20#1 字符串拼接,变量age必须是str类型print('he is '+str(age)+' years old')执行结果he is 20 years old#2 %s代表变量,print('he is %s years old' % age)执行结果he is 20 years old #3 formatprint('{} is {} years... 阅读全文
posted @ 2019-08-21 16:42 Wsnan 阅读(3248) 评论(0) 推荐(0)
摘要:原文链接:https://www.cnblogs.com/ming5218/p/7965973.html 一、ConfigParser简介 ConfigParser 是用来读取配置文件的包。配置文件的格式如下:中括号“[ ]”内包含的为section。section 下面为类似于key-value 阅读全文
posted @ 2019-08-21 11:20 Wsnan 阅读(445) 评论(0) 推荐(0)