首页 文章 精选 留言 我的

精选列表

搜索[Python环境],共10000篇文章
优秀的个人博客,低调大师

Python基础系列-HTTP协议中get和post的7个区别,欢迎补充

版权声明:如需转载,请注明转载地址。 https://blog.csdn.net/oJohnny123/article/details/82085521 get post 参数通过url传递 参数放在request body中传递 url中传递的参数是有长度限制的(1024) 网页显示内容莫名其妙被截断的情况下,可以往这个思路检查一下 无限制 参数直接暴露在url中 / 只能进行url编码 支持多种编码方式 浏览器主动cache 不会 请求参数会被完整保留在浏览历史记录里 不保留 浏览器HTTP请求中产生一个TCP数据包(对于GET方式的请求,浏览器会把http header和data一并发送出去,服务器响应200(返回数据);) 产生两个TCP数据包(而对于POST,浏览器先发送header,服务器响应100 continue,浏览器再发送data,服务器响应200 ok(返回数据)。)

优秀的个人博客,低调大师

Python爬虫(三)——开封市58同城出租房决策树构建

决策树框架: 1 # coding=utf-8 2 import matplotlib.pyplot as plt 3 4 decisionNode = dict(boxstyle='sawtooth', fc='10') 5 leafNode = dict(boxstyle='round4', fc='0.8') 6 arrow_args = dict(arrowstyle='<-') 7 8 9 def plotNode(nodeTxt, centerPt, parentPt, nodeType): 10 createPlot.ax1.annotate(nodeTxt, xy=parentPt, xycoords='axes fraction', \ 11 xytext=centerPt, textcoords='axes fraction', \ 12 va='center', ha='center', bbox=nodeType, arrowprops \ 13 =arrow_args) 14 15 16 def getNumLeafs(myTree): 17 numLeafs = 0 18 firstStr = list(myTree.keys())[0] 19 secondDict = myTree[firstStr] 20 for key in secondDict: 21 if (type(secondDict[key]).__name__ == 'dict'): 22 numLeafs += getNumLeafs(secondDict[key]) 23 else: 24 numLeafs += 1 25 return numLeafs 26 27 28 def getTreeDepth(myTree): 29 maxDepth = 0 30 firstStr = list(myTree.keys())[0] 31 secondDict = myTree[firstStr] 32 for key in secondDict: 33 if (type(secondDict[key]).__name__ == 'dict'): 34 thisDepth = 1 + getTreeDepth((secondDict[key])) 35 else: 36 thisDepth = 1 37 if thisDepth > maxDepth: maxDepth = thisDepth 38 return maxDepth 39 40 41 def retrieveTree(i): 42 # 预先设置树的信息 43 listOfTree = [] 44 return listOfTree[i] 45 46 47 def createPlot(inTree): 48 fig = plt.figure(1, facecolor='white') 49 fig.clf() 50 axprops = dict(xticks=[], yticks=[]) 51 createPlot.ax1 = plt.subplot(111, frameon=False, **axprops) 52 plotTree.totalW = float(getNumLeafs(inTree)) 53 plotTree.totalD = float(getTreeDepth(inTree)) 54 plotTree.xOff = -0.5 / plotTree.totalW; 55 plotTree.yOff = 1.0 56 plotTree(inTree, (0.5, 1.0), '') 57 plt.title('kaifeng.58.com\n') 58 plt.show() 59 60 61 def plotMidText(cntrPt, parentPt, txtString): 62 xMid = (parentPt[0] - cntrPt[0]) / 2.0 + cntrPt[0] 63 yMid = (parentPt[1] - cntrPt[1]) / 2.0 + cntrPt[1] 64 createPlot.ax1.text(xMid, yMid, txtString) 65 66 67 def plotTree(myTree, parentPt, nodeTxt): 68 numLeafs = getNumLeafs(myTree) 69 depth = getTreeDepth(myTree) 70 firstStr = list(myTree.keys())[0] 71 cntrPt = (plotTree.xOff + (1.0 + float(numLeafs)) / 2.0 / plotTree.totalW, \ 72 plotTree.yOff) 73 plotMidText(cntrPt, parentPt, nodeTxt) 74 plotNode(firstStr, cntrPt, parentPt, decisionNode) 75 secondDict = myTree[firstStr] 76 plotTree.yOff = plotTree.yOff - 1.0 / plotTree.totalD 77 for key in secondDict: 78 if type(secondDict[key]).__name__ == 'dict': 79 plotTree(secondDict[key], cntrPt, str(key)) 80 else: 81 plotTree.xOff = plotTree.xOff + 1.0 / plotTree.totalW 82 plotNode(secondDict[key], (plotTree.xOff, plotTree.yOff), \ 83 cntrPt, leafNode) 84 plotMidText((plotTree.xOff, plotTree.yOff), cntrPt, str(key)) 85 plotTree.yOff = plotTree.yOff + 1.0 / plotTree.totalD 86 87 88 if __name__ == '__main__': 89 myTree = retrieveTree(2) 90 createPlot(myTree) 构造信息: 1 [{'no surfacing': {0: 'no', 1: {'flipper': {0: 'no', 1: 'yes'}}}}, 2 {'no surfacing': {0: 'no', 1: {'flipper': {0: {'head': {0: 'no', 1: 'yes'}}, 1: 'no'}}}}, 3 {'House prices <= 2000': { 4 1: {'Room size >= 50': {1: 'Yes', 0: 'No'}}, 0: 'No'}}] 结果:

优秀的个人博客,低调大师

Python爬虫(二)——对开封市58同城出租房数据进行分析

出租房面积(area) 出租房价格(price) 对比信息 代码 1 import matplotlib as mpl 2 import matplotlib.pyplot as plt 3 import pandas as pad 4 import seaborn as sns 5 import numpy as np 6 7 sns.set_style('dark') 8 kf = pad.read_csv('kf.csv') 9 10 def sinplotone(): 11 fig,ax = plt.subplots() 12 ax.violinplot(kf['price']) 13 plt.show() 14 15 def sinplottwo(): 16 sns.set_style('whitegrid') 17 sns.boxplot(kf['price'],palette='deep') 18 # sns.despine(left=True) 19 plt.show() 20 21 def sinplotthree(): 22 sns.distplot(kf['price']) 23 plt.show() 24 25 def s(): 26 df = pad.DataFrame(kf['area'],kf['price']) 27 sns.jointplot(x='x',y='y',data=df) 28 plt.show() 29 30 if __name__ == '__main__': 31 fig,ax = plt.subplots() 32 ax.scatter(kf['area'],kf['price'],12) 33 plt.show()

优秀的个人博客,低调大师

python django打造自己的喜马拉雅 3(主页前端+数据库)

链接: 1背景和功能 2分析喜马拉雅接口 Django Model设计: 先设计两张表,一张用来存储专辑(专辑名,封面图,专辑id,添加时间),另外一张存储专辑下每一集的信息(所属的专辑,序号,trackid,音频地址,添加时间) 为了防止正在爬的时候,有人再次提交。加一个status表。 前端布局: 首页的布局什么的就简单写了,只需要一个输入框,能输入新的专辑id,再来个列表,展示已经爬过的专辑。 输入框的样式是不是很熟悉呀?没错,直接抄的喜马拉雅主页的,连css名字都不想改。 输入了albumId之后,post到服务器,开始抓取index---trackid: 首页路由url配置: View中处理: 把之前的两个接口封装到class ScrapManager中,没啥特别的地方,只是看起来要简洁些: 接下来完善播放页面具体功能。

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

用户登录
用户注册
修改密码
忘记密码