python
文章平均质量分 56
bismillahhh
walk slow down
展开
-
python awesome code
原因是,L 中的每一个元素都是一个 lambda 函数,这些 lambda 函数都使用了外部变量 i,而 i 的值在循环结束后是 4,因此每个 lambda 函数中 i 的值都是 4。在这段代码中,使用 lambda 表达式创建了一个带有一个参数 x 的函数,函数的返回值是 x 乘以 i。在 lambda 表达式中,可以访问外部作用域中的变量,这被称为变量捕获。代码中,lambda 表达式访问了循环中定义的变量 i,而这个变量在循环结束后的值是 4,因此每个 lambda 函数中 i 的值都是 4。原创 2023-06-02 14:29:17 · 610 阅读 · 0 评论 -
sql表数据到图结构转换服务
4、将结构化的图数据作为最小服务demo数据使用框架使用flask。2、将人物关键字段作为扩展关系进行图结构化。3、生成图结构化数据。原创 2022-07-21 16:46:33 · 738 阅读 · 1 评论 -
django 项目 相关问题
django 项目 相关问题原创 2022-06-06 16:00:20 · 276 阅读 · 0 评论 -
python 从Url获取pdf内容:
def getpdfContent(url): import urllib3 import io import PyPDF2 urllib3.disable_warnings() contents = '' # url = 'https://www.apc-paris.com/system/files/file_fields/2022/04/14/apc-trophees-coachcopro-vf.pdf' with urllib3.PoolMa..原创 2022-04-19 11:29:49 · 1030 阅读 · 0 评论 -
python float 精度 处理
way1:Decimal示例代码:from decimal import DecimalnumStr = '1.13'print('====a', Decimal(numStr) * Decimal('1e8'))print('====b', Decimal(numStr) * Decimal(1e8))print('====c', Decimal(float(numStr)) * Decimal('1e8'))print('====d', Decimal(float(numStr).原创 2022-04-09 11:36:58 · 4126 阅读 · 1 评论 -
PYLTP 0.2.1 centos 6.5安装 过程
way1:pip install pyltp==0.2.1 -iSimple Index结果:安装未成功:中间安装编译过程超长,直接退出了way2:离线安装 :https://github.com/HIT-SCIR/pyltp安装未成功:下载解压之后,python setup.py install 提示一下异常且不会修改:subprocess.CalledProcessError: Command '['cmake', '/usr/neoapi/neo4j/pyltp-mast..原创 2022-04-06 14:08:25 · 1970 阅读 · 0 评论 -
python 条件判断 if
# aaa True 1 np.nan pd.isnull(np.nan)# bbb False None 0 [] '' {} () pd.isnull('')python 条件判断 if:正确判断是否执行if a: print('aaa',a)else: print('bbb',a)原创 2022-03-16 11:34:51 · 1264 阅读 · 0 评论 -
Ubuntu Nemo使用测试
Ubuntu 显卡信息查询=====ubuntu显卡信息查询(wj@py38) zzsn@zzsn:~/wj$ lspci |grep -i vga01:00.0 VGA compatible controller: NVIDIA Corporation Device 2503 (rev a1)=====ubuntu显卡信息查询(wj@py38) zzsn@zzsn:~/wj$ nvidia-smi -lWed Feb 16 12:40:07 2022 +-----------原创 2022-02-16 12:43:21 · 1559 阅读 · 0 评论 -
Nvidia Nemo 使用笔记
环境:conda 4.5.11 + cuda +1 conda相关:conda:基本应用【查询版本:环境更新:添加镜像:创建新环境:使用】=====查看安装的conda 版本:(base) C:\Users\Administrator>conda -Vconda 4.5.11=====查看当前conda 环境中安装的库:conda env list=====添加镜像:conda config --add channels https://pypi.douban.c.原创 2022-02-13 14:28:12 · 2642 阅读 · 0 评论 -
正则 常用示例
1、使用示例替换正则匹配到的字符ptn = re.compile(r'\(function (.|\n)*\(\);')content = re.sub(ptn,'',record['内容'].strip())原创 2022-01-27 14:27:16 · 250 阅读 · 0 评论 -
图数据库 py2neo driver 使用笔记
1、Nodepy2neo.data – Graph data types — py2neo 2021.12、relationshipspy2neo.data – Graph data types — py2neo 2021.13、pathpy2neo.data – Graph data types — py2neo 2021.1 1、路径查询根据起始节点与目标节点查询关系图cypher语句MATCH p=(n)-[*..3].........原创 2022-01-22 17:48:27 · 982 阅读 · 2 评论 -
python 代码打包成exe文件 相关笔记
目的1、代码可以随处执行2、方便迁移以及别人直接使用1、下周pyinstaller原创 2021-12-30 16:05:46 · 1753 阅读 · 0 评论 -
python excel处理 pandas 统计重复数据
读取excel文件,并找到重复的数据df = pd.read_excel(r'project.xls',sheet_name='Sheet1')data = {}dupList = [k for k,v in df['title'].value_counts().to_dict().items() if v > 1]print(type(dupList),len(dupList),dupList)for i in dupList: d = df[df['title']==i..原创 2021-11-04 11:19:43 · 1357 阅读 · 0 评论 -
python 时间字符串比较
时间字符比较方法:import datetimeimport time#way1tms = ['2021-06-17 00:53:00','2021-06-18 00:53:00','2021-06-16 00:53:00','2021-06-19 00:53:00','2021-06-11 00:53:00']print("===way1===")for tm in tms: ntm = time.strptime(tm, "%Y-%m-%d %H:%M:%S") if n.原创 2021-08-16 16:09:17 · 2089 阅读 · 0 评论 -
python pandas 批量合并相同列名的csv文件
python 实现过程文件批量合并import pandas as pdimport osdef getFile(path): dirlst= [] dirs = os.listdir(path) for i in dirs: file = os.path.splitext(i)[0] if file.startswith('爬虫_'): filename = path + '\\' + file+'.csv' .原创 2021-01-31 23:50:40 · 1774 阅读 · 1 评论 -
python list操作
1、按照固定的数量扩展期望list:[1,1,2,2,3,3,4,4]开始list:be = [1,2,3,4]be = [1,2,3,4]af = [val for val in be for i in range(2)]print(af)2、按照一定的序列扩展期望list:[1,1,2,2,3,4,4,4]开始list:be = [1,2,3,4]辅助的list:index=[2,2,1,3]index= [2,2,1,3]af= []n = 0whil原创 2020-08-24 17:18:39 · 84 阅读 · 0 评论 -
python中的各种异常处理——更新pandas库(from 0.20.0——0.24.0)
想要使用pandas中的属性,但是版本不一致,且事先已经pip uninstall pandaspip install --user https://pypi.tuna.tsinghua.edu.cn/simple pandas==0.24.0Collecting https://pypi.tuna.tsinghua.edu.cn/simple Downloading https://...原创 2019-04-27 10:24:36 · 3367 阅读 · 0 评论 -
python爬虫基础(一) 爬虫过程
链接:https://cuiqingcai.com/927.html(原博本使用版本略低,本人使用的版本为3anaconda 3.5.3)1、爬虫基本流程:1.发起请求:通过HTTP库向目标站点发起请求,即发送一个Request,请求可以包含额外的headers等信息,等待服务器响应。2.获取响应内容:如果服务器能正常响应,会得到一个Response,Response的内容便是所要获取的......转载 2019-04-25 20:46:14 · 702 阅读 · 0 评论