我的编程空间,编程开发者的网络收藏夹
学习永远不晚

Python发送Post请求及解析响应结果

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

Python发送Post请求及解析响应结果

一、Post请求

1、使用python发送一个Post请求

有时候遇到请求url中有很多参数。

1.1 示例1

accounts和pwd请到http://shop-xo.hctestedu.com/注册。

import requests# 请求体data = {    "accounts": "xx",    "pwd": "xxx",    "type": "username"}# 只有php项目需要application和application_client_type# 写法一, 在请求Url中带上所有参数,application和application_client_type,用&隔开response = requests.post(url="http://shop-xo.hctestedu.com/index.php?"    "s=api/user/login"    "&application=app"    "&applicaiton_client_type=weixin", json=data)# 输出响应结果print(response.text)

执行结果:

{"msg":"登录成功","code":0,"data":{"id":"7073","username":"xx","nickname":"","mobile":"","email":"","avatar":"http:\/\/shop-xo.hctestedu.com\/static\/index\/default\/images\/default-user-avatar.jpg","alipay_openid":"","weixin_openid":"","weixin_unionid":"","weixin_web_openid":"","baidu_openid":"","toutiao_openid":"","qq_openid":"","qq_unionid":"","integral":"189","locking_integral":"0","referrer":"0","add_time":"1646195490","add_time_text":"2022-03-02 12:31:30","mobile_security":"","email_security":"","user_name_view":"xx","is_mandatory_bind_mobile":0,"token":"xxxxxx"}}

1.2 示例2

使用不定长参数 params,将url中需要的参数单独封装。

import requests# 请求体data = {    "accounts": "xx",    "pwd": "xxx",    "type": "username"}# 使用不定长参数paramsparam_data = {    "application": "app",    "application_client_type": "weixin"}# 写法2:使用不定长参数paramsresponse = requests.post(url="http://shop-xo.hctestedu.com/index.php?" "s=api/user/login", params=param_data, json=data)# 输出响应结果print(response.text)

执行结果:

{"msg":"登录成功","code":0,"data":{"id":"22299","username":"xx","nickname":"","mobile":"","email":"","avatar":"http:\/\/shop-xo.hctestedu.com\/static\/index\/default\/images\/default-user-avatar.jpg","alipay_openid":"","weixin_openid":"","weixin_unionid":"","weixin_web_openid":"","baidu_openid":"","toutiao_openid":"","qq_openid":"","qq_unionid":"","integral":"0","locking_integral":"0","referrer":"0","add_time":"1678005098","add_time_text":"2023-03-05 16:31:38","mobile_security":"","email_security":"","user_name_view":"xx","is_mandatory_bind_mobile":0,"token":"xxxxx"}}

二、获取Response body

1、response.text

用type()查看response.text的类型,是str

import requests# 请求体data = {    "accounts": "xx",    "pwd": "xxx",    "type": "username"}# 使用不定长参数paramsparam_data = {    "application": "app",    "application_client_type": "weixin"}# 写法2:使用不定长参数paramsresponse = requests.post(url="http://shop-xo.hctestedu.com/index.php?" "s=api/user/login", params=param_data, json=data)# 输出响应结果print(response.text)print(type(response.text))

执行结果:

{"msg":"登录成功","code":0,"data":{"id":"22299","username":"xx","nickname":"","mobile":"","email":"","avatar":"http:\/\/shop-xo.hctestedu.com\/static\/index\/default\/images\/default-user-avatar.jpg","alipay_openid":"","weixin_openid":"","weixin_unionid":"","weixin_web_openid":"","baidu_openid":"","toutiao_openid":"","qq_openid":"","qq_unionid":"","integral":"0","locking_integral":"0","referrer":"0","add_time":"1678005098","add_time_text":"2023-03-05 16:31:38","mobile_security":"","email_security":"","user_name_view":"xx","is_mandatory_bind_mobile":0,"token":"xxxxx"}}

2、response.json()

用type()查看response.json()的类型,是dict

import requests# 请求体data = {    "accounts": "xx",    "pwd": "xxx",    "type": "username"}# 使用不定长参数paramsparam_data = {    "application": "app",    "application_client_type": "weixin"}# 写法2:使用不定长参数paramsresponse = requests.post(url="http://shop-xo.hctestedu.com/index.php?" "s=api/user/login", params=param_data, json=data)# 输出响应结果print(response.json())print(type(response.json()))

执行结果:

{"msg":"登录成功","code":0,"data":{"id":"22299","username":"xx","nickname":"","mobile":"","email":"","avatar":"http:\/\/shop-xo.hctestedu.com\/static\/index\/default\/images\/default-user-avatar.jpg","alipay_openid":"","weixin_openid":"","weixin_unionid":"","weixin_web_openid":"","baidu_openid":"","toutiao_openid":"","qq_openid":"","qq_unionid":"","integral":"0","locking_integral":"0","referrer":"0","add_time":"1678005098","add_time_text":"2023-03-05 16:31:38","mobile_security":"","email_security":"","user_name_view":"xx","is_mandatory_bind_mobile":0,"token":"xxxxx"}}

三、获取响应状态码:res.status_code

print(response.status_code)

执行结果:

200

更多状态码:

状态代码有三位数字组成,第一个数字定义了响应的类别,共分五种类别:1xx:指示信息--表示请求已接收,继续处理2xx:成功--表示请求已被成功接收、理解、接受3xx:重定向--要完成请求必须进行更进一步的操作4xx:客户端错误--请求有语法错误或请求无法实现5xx:服务器端错误--服务器未能实现合法的请求常见状态码:200 OK//客户端请求成功400 Bad Request//客户端请求有语法错误,不能被服务器所理解401 Unauthorized//请求未经授权,这个状态代码必须和WWW-Authenticate报头域一起使用403 Forbidden//服务器收到请求,但是拒绝提供服务404 Not Found//请求资源不存在,eg:输入了错误的URL500 Internal Server Error//服务器发生不可预期的错误503 Server Unavailable//服务器当前不能处理客户端的请求,一段时间后可能恢复正常

四、获取响应cookies:res.cookies

print(response.cookies)

执行结果:

]>

五、获取响应headers:res.headers

print(response.headers)

执行结果:

{'Server': 'nginx', 'Date': 'Sun, 05 Mar 2023 10:04:02 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Set-Cookie': 'PHPSESSID=ul9qsgallg17d5am81q08pfhj0; path=/; HttpOnly', 'Expires': 'Thu, 19 Nov 1981 08:52:00 GMT', 'Cache-Control': 'no-store, no-cache, must-revalidate', 'Pragma': 'no-cache'}

六、获取响应结果原始内容:res.content

content,没有经过编译的,以字节的形式展示。而上述提到的text是编译过的。自动找到请求头中的编码格式,进行解析。

print(response.content)print(type(response.content))

执行结果:

b'{"msg":"\xe7\x99\xbb\xe5\xbd\x95\xe6\x88\x90\xe5\x8a\x9f","code":0,"data":{"id":"22299","username":"xxxxx","nickname":"","mobile":"","email":"","avatar":"http:\\/\\/shop-xo.hctestedu.com\\/static\\/index\\/default\\/images\\/default-user-avatar.jpg","alipay_openid":"","weixin_openid":"","weixin_unionid":"","weixin_web_openid":"","baidu_openid":"","toutiao_openid":"","qq_openid":"","qq_unionid":"","integral":"0","locking_integral":"0","referrer":"0","add_time":"1678005098","add_time_text":"2023-03-05 16:31:38","mobile_security":"","email_security":"","user_name_view":"xxxxx","is_mandatory_bind_mobile":0,"token":"d653d78ac417f65e1cd38c6f3e220341"}}'

content还支持手动的编码,例如使用utf-8编码,编码后的是str类型,json本质是一种字符串类型

resp = response.content.decode("utf-8")print(resp)print(type(resp))

执行结果:

{"msg":"登录成功","code":0,"data":{"id":"22299","username":"xxxxx","nickname":"","mobile":"","email":"","avatar":"http:\/\/shop-xo.hctestedu.com\/static\/index\/default\/images\/default-user-avatar.jpg","alipay_openid":"","weixin_openid":"","weixin_unionid":"","weixin_web_openid":"","baidu_openid":"","toutiao_openid":"","qq_openid":"","qq_unionid":"","integral":"0","locking_integral":"0","referrer":"0","add_time":"1678005098","add_time_text":"2023-03-05 16:31:38","mobile_security":"","email_security":"","user_name_view":"xxxxx","is_mandatory_bind_mobile":0,"token":"d653d78ac417f65e1cd38c6f3e220341"}}

七、获取响应结果:最原生的状态,对象在内存中的地址:res.raw

print(response.raw)print(type(response.raw))

执行结果:

八、解析响应数据

响应数据如下:

{    "msg": "登录成功",    "code": 0,    "data": {        "id": "22299",        "username": "Summer",        "nickname": "",        "mobile": "",        "email": "",        "avatar": "http:\/\/shop-xo.hctestedu.com\/static\/index\/default\/images\/default-user-avatar.jpg",        "alipay_openid": "",        "weixin_openid": "",        "weixin_unionid": "",        "weixin_web_openid": "",        "baidu_openid": "",        "toutiao_openid": "",        "qq_openid": "",        "qq_unionid": "",        "integral": "0",        "locking_integral": "0",        "referrer": "0",        "add_time": "1678005098",        "add_time_text": "2023-03-05 16:31:38",        "mobile_security": "",        "email_security": "",        "user_name_view": "chengcheng",        "is_mandatory_bind_mobile": 0,        "token": "d653d78ac417f65e1cd38c6f3e220341"    }}

通常我们获取响应数据后,是需要进行结果验证的。例如,我想从登录接口的响应中拿到token,供后面的接口请求鉴权使用。

1、字典方式解析及其缺点

上面已经讲到,可以使用response.json()方法拿到一个字典。既然是字典,就可以用处理字典的方式来获取某个字段的值。

resp = response.json()token = resp["data"]["token"]print(token )

执行结果:

d653d78ac417f65e1cd38c6f3e220341

字典解析的缺点:如果接口数据异常,响应体缺少某个字段,就会发生keyerror,导致程序异常。

resp = response.json()token = resp["data"]["token1"]print(token )

执行结果:

Traceback (most recent call last):  File "E:\Coding\python-workspace\Interface_test\first_requests.py", line 128, in     token = resp["data"]["token1"]KeyError: 'token1'

2、Jsonpath表达式解析及其优点

上面的响应body结构比较简单,如果我们要解析特别复杂的响应体,通过字典方式就很复杂。这个时候更推荐jsonpath。需要引入jsonpath库。

import jsonpathresp = response.json()  # 将返回值转换成字典格式token = jsonpath.jsonpath(resp, '$..token')  # token的jsonpath表达式:$..tokenprint(token)

执行结果:

['d653d78ac417f65e1cd38c6f3e220341']

通过结果来看,获取到的token是只有一个元素的列表。我们要想拿到token通过下标访问。
修改上述代码:

import jsonpathresp = response.json()  # 将返回值转换成字典格式token = jsonpath.jsonpath(resp, '$..token')  # token的jsonpath表达式:$..tokenprint(token[0])

执行结果:

d653d78ac417f65e1cd38c6f3e220341

Jsonpath表达式解析的优点如果响应体缺少某个字段,通过Jsonpath表达式解析不到结果,就会返回False,永远不会发生异常。我们可根据返回结果进行后续处理。

import jsonpathresp = response.json()  # 将返回值转换成字典格式# 使用错误的jsonpath表达式token = jsonpath.jsonpath(resp, '$..token1')  # token的jsonpath表达式:$..token1if isinstance(token, List):    print(f'可以解析到token,值为:{token[0]}')else:    print(f'解析不到token,结果为:{token}')# 使用正确的jsonpath表达式token = jsonpath.jsonpath(resp, '$..token')  # token的jsonpath表达式:$..tokenif isinstance(token, List):    print(f'可以解析到token,值为:{token[0]}')else:    print(f'解析不到token,结果为:{token}')

执行结果:

解析不到token,结果为:False可以解析到token,值为:d653d78ac417f65e1cd38c6f3e220341

3、如何知道自己写的jsonpath表达式是否正确呢?

jsonpath在线校验工具:http://jsonpath.com/
将response粘贴在Inputs区域,在JSONPath区域输入表达式,在Evaluation Results区域查看是否解析到期望的值。当解析不到值时,返回的是空列表(No match)
在这里插入图片描述jsonpath表达式语法
在这里插入图片描述

九、获取请求的信息

print(f'请求url:{response.request.url}')print(f'请求方法:{response.request.method}')print(f'请求Header:{response.request.headers}')print(f'请求路径:{response.request.path_url}')

执行结果:

请求url:http://shop-xo.hctestedu.com/index.php?s=api/user/login&application=app&application_client_type=weixin请求方法:POST请求Header:{'User-Agent': 'python-requests/2.28.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': '**', 'Connection': 'keep-alive', 'Content-Length': '69', 'Content-Type': 'application/json'}{"msg":"登录成功","code":0,"data":{"id":"22299","username":"xxxxx","nickname":"","mobile":"","email":"","avatar":"http:\/\/shop-xo.hctestedu.com\/static\/index\/default\/images\/default-user-avatar.jpg","alipay_openid":"","weixin_openid":"","weixin_unionid":"","weixin_web_openid":"","baidu_openid":"","toutiao_openid":"","qq_openid":"","qq_unionid":"","integral":"0","locking_integral":"0","referrer":"0","add_time":"1678005098","add_time_text":"2023-03-05 16:31:38","mobile_security":"","email_security":"","user_name_view":"xxxxx","is_mandatory_bind_mobile":0,"token":"d653d78ac417f65e1cd38c6f3e220341"}}

2、data=data

请求头默认为:application/x-www-form-urlencoded

url = 'http://shop-xo.hctestedu.com/index.php?s=api/user/login'res = requests.post(url=url, data=data, params=param_data)# 查看请求中的请求头信息,Content-Type=application/x-www-form-urlencodedprint(res.request.headers)print(res.text)

执行结果:

{'User-Agent': 'python-requests/2.28.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': '**', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '50'}

2、Content-Type:application/x-www-form-urlencoded

headers = {    # 'Content-Type': 'application/json'    'Content-Type': 'application/x-www-form-urlencoded'}url = 'http://shop-xo.hctestedu.com/index.php?s=api/user/login'res = requests.post(url=url, params=param_data, data=data, headers=headers)print(res.request.headers)

执行结果:

{'User-Agent': 'python-requests/2.28.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'Connection': 'keep-alive', 'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': '69'}

十一、Json和字典数据转换

1、json.dumps(),将字典转换成Json

使用json.dumps()可以将字典转换成Json

test = {    "msg": "登录成功",    "code": 0,    "data": {        "id": "22299",        "username": "Summer",        "nickname": "",        "mobile": "",        "email": "",        "avatar": "http:\/\/shop-xo.hctestedu.com\/static\/index\/default\/images\/default-user-avatar.jpg",        "alipay_openid": "",        "weixin_openid": "",        "weixin_unionid": "",        "weixin_web_openid": "",        "baidu_openid": "",        "toutiao_openid": "",        "qq_openid": "",        "qq_unionid": "",        "integral": "0",        "locking_integral": "0",        "referrer": "0",        "add_time": "1678005098",        "add_time_text": "2023-03-05 16:31:38",        "mobile_security": "",        "email_security": "",        "user_name_view": "chengcheng",        "is_mandatory_bind_mobile": 0,        "token": "d653d78ac417f65e1cd38c6f3e220341"    }}print(type(test))print(json.dumps(test))print(type(json.dumps(test)))

执行结果:

{"msg": "\u767b\u5f55\u6210\u529f", "code": 0, "data": {"id": "22299", "username": "Summer", "nickname": "", "mobile": "", "email": "", "avatar": "http:\\/\\/shop-xo.hctestedu.com\\/static\\/index\\/default\\/images\\/default-user-avatar.jpg", "alipay_openid": "", "weixin_openid": "", "weixin_unionid": "", "weixin_web_openid": "", "baidu_openid": "", "toutiao_openid": "", "qq_openid": "", "qq_unionid": "", "integral": "0", "locking_integral": "0", "referrer": "0", "add_time": "1678005098", "add_time_text": "2023-03-05 16:31:38", "mobile_security": "", "email_security": "", "user_name_view": "chengcheng", "is_mandatory_bind_mobile": 0, "token": "d653d78ac417f65e1cd38c6f3e220341"}}

2、json.loads(),将Json转换成字典

使用json.loads()可以将Json转换成字典

print(json.loads(json.dumps(test)))print(type(json.loads(json.dumps(test))))

执行结果:

{'msg': '登录成功', 'code': 0, 'data': {'id': '22299', 'username': 'Summer', 'nickname': '', 'mobile': '', 'email': '', 'avatar': 'http:\\/\\/shop-xo.hctestedu.com\\/static\\/index\\/default\\/images\\/default-user-avatar.jpg', 'alipay_openid': '', 'weixin_openid': '', 'weixin_unionid': '', 'weixin_web_openid': '', 'baidu_openid': '', 'toutiao_openid': '', 'qq_openid': '', 'qq_unionid': '', 'integral': '0', 'locking_integral': '0', 'referrer': '0', 'add_time': '1678005098', 'add_time_text': '2023-03-05 16:31:38', 'mobile_security': '', 'email_security': '', 'user_name_view': 'chengcheng', 'is_mandatory_bind_mobile': 0, 'token': 'd653d78ac417f65e1cd38c6f3e220341'}}

3、json格式报文发送

方法一:参数是data,值:将字典data转换成json

url = 'http://shop-xo.hctestedu.com/index.php?s=api/user/login'headers = {    'Content-Type': 'application/json'}res = requests.post(url=url, data=json.dumps(data), headers=headers)print(res.text)

方法二:参数是json,值:字典data

url = 'http://shop-xo.hctestedu.com/index.php?s=api/user/login'res = requests.post(url=url, json=data)print(res.text)print(res.json())print(type(res.json()))assert "登录成功" == res.json()['msg']

十二、获取接口响应时间

url = 'http://shop-xo.hctestedu.com/index.php?s=api/user/login'res = requests.post(url=url, json=data)print(res.text)# 获取接口响应时间,单位秒print(r.elapsed.total_seconds())

执行结果:

{"msg":"登录成功","code":0,"data":{"body_html":""}}0.078264

十三、接口调用失败处理

同一个用例中有多个接口调用,一个接口调用失败如何防止程序终止?
用于判断接口请求的状态码是否为200,如果是,则返回none,如果不是则返回异常。
调用接口时结合try…except进行使用。

# 模拟接口404,使用不存在的request url: login1url = 'http://shop-xo.hctestedu.com/index.php?s=api/user/login1'res = requests.post(url=url, json=data)try:    assert 200 == res.status_codeexcept:    # 异常处理1:直接跳过,可继续执行后面代码    # pass    # 异常处理2:打印详细异常信息    print(res.status_code)    res.raise_for_status()else:    print(res.text)

执行结果:

404Traceback (most recent call last):  File "E:\Coding\python-workspace\Interface_test\first_requests.py", line 220, in     assert 200 == res.status_codeAssertionErrorDuring handling of the above exception, another exception occurred:Traceback (most recent call last):  File "E:\Coding\python-workspace\Interface_test\first_requests.py", line 226, in     res.raise_for_status()  File "D:\Developer\Python\Python310\lib\site-packages\requests\models.py", line 1021, in raise_for_status    raise HTTPError(http_error_msg, response=self)requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://shop-xo.hctestedu.com/index.php?s=api/user/login1

十四、接口超时

url = 'http://shop-xo.hctestedu.com/index.php?s=api/user/login'try:    res = requests.post(url=url, json=data, timeout=0.01)  # timeout,单位秒except (TimeoutError, ReadTimeout, ConnectTimeout):    # ConnectTimeout:指的是建立连接所用的时间,适用于网络状况正常的情况下,两端连接所用的时间。    # ReadTimeout:指的是建立连接后从服务器读取到可用资源所用的时间。    print("发生错误,请稍后重试")else:    # 获取接口响应时间,单位秒    print(res.elapsed.total_seconds())    print(res.text)

执行结果:

发生错误,请稍后重试

当把timeout改成0.1,执行结果:

0.07419{"msg":"登录成功","code":0,"data":{"body_html":""}}

来源地址:https://blog.csdn.net/weixin_44691253/article/details/129348832

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

Python发送Post请求及解析响应结果

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

python怎样通过get方式,post方式发送http请求和接收http响应

这期内容当中小编将会给大家带来有关python怎样通过get方式,post方式发送http请求和接收http响应,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。1.GET方法get方法是直接将要请求的数据放
2023-06-04

如何使用golang中的http.Post函数发送POST请求并获取响应

如何使用golang中的http.Post函数发送POST请求并获取响应在使用golang进行网络编程时,http包是我们经常使用的一个重要模块。其中,http.Post函数是一个非常实用的函数,可以方便地发送POST请求并获取响应结果。下
如何使用golang中的http.Post函数发送POST请求并获取响应
2023-11-18

Node.js发送HTTP客户端请求并显示响应结果的方法示例

本文实例讲述了Node.js发送HTTP客户端请求并显示响应结果的方法。分享给大家供大家参考,具体如下: wget.js:发送HTTP客户端请求并显示响应的各种结果 options对象描述了将要发出的请求。 data事件在数据到达时被触发,
2022-06-04

Python HTTP请求详解:发送、接收和解析网络请求

本文详细讲解了 Python HTTP 请求的基本流程,包括发送请求、接收响应和解析响应,并提供了演示代码,帮助您快速掌握 HTTP 请求的实现方法。
Python HTTP请求详解:发送、接收和解析网络请求
2024-02-23

Python如何解析ElasticSearch的查询结果?(通过Python如何处理和解析ElasticSearch的查询响应?)

使用Python解析Elasticsearch查询结果的指南:解析JSON响应:使用json模块解析JSON格式的结果。提取相关字段:通过访问嵌套字典和列表提取文档ID和来源。处理嵌套数据结构:使用collections模块处理数组字段和嵌套对象。高级解析:利用XPath、正则表达式或第三方库进行更复杂的数据提取。最佳实践:避免eval()函数,使用json模块,考虑第三方库,优化代码以有效处理大量响应。
Python如何解析ElasticSearch的查询结果?(通过Python如何处理和解析ElasticSearch的查询响应?)
2024-04-02

编程热搜

  • Python 学习之路 - Python
    一、安装Python34Windows在Python官网(https://www.python.org/downloads/)下载安装包并安装。Python的默认安装路径是:C:\Python34配置环境变量:【右键计算机】--》【属性】-
    Python 学习之路 - Python
  • chatgpt的中文全称是什么
    chatgpt的中文全称是生成型预训练变换模型。ChatGPT是什么ChatGPT是美国人工智能研究实验室OpenAI开发的一种全新聊天机器人模型,它能够通过学习和理解人类的语言来进行对话,还能根据聊天的上下文进行互动,并协助人类完成一系列
    chatgpt的中文全称是什么
  • C/C++中extern函数使用详解
  • C/C++可变参数的使用
    可变参数的使用方法远远不止以下几种,不过在C,C++中使用可变参数时要小心,在使用printf()等函数时传入的参数个数一定不能比前面的格式化字符串中的’%’符号个数少,否则会产生访问越界,运气不好的话还会导致程序崩溃
    C/C++可变参数的使用
  • css样式文件该放在哪里
  • php中数组下标必须是连续的吗
  • Python 3 教程
    Python 3 教程 Python 的 3.0 版本,常被称为 Python 3000,或简称 Py3k。相对于 Python 的早期版本,这是一个较大的升级。为了不带入过多的累赘,Python 3.0 在设计的时候没有考虑向下兼容。 Python
    Python 3 教程
  • Python pip包管理
    一、前言    在Python中, 安装第三方模块是通过 setuptools 这个工具完成的。 Python有两个封装了 setuptools的包管理工具: easy_install  和  pip , 目前官方推荐使用 pip。    
    Python pip包管理
  • ubuntu如何重新编译内核
  • 改善Java代码之慎用java动态编译

目录