摘要: 转载:https://www.cnblogs.com/lemon-feng/p/11208435.html 注意发布python3的项目的时候,用python3(因为默认的python是python2),33333.当时就因为这个导包找不到搞了半天 阅读全文
posted @ 2020-08-07 14:26 bwcheng 阅读(122) 评论(0) 推荐(0)
摘要: %s,表示格化式一个对象为字符,可以理解成字符串的占位符%d,整数"Hello, %s"%"zhang3" => "Hello, zhang3""%d"%33 => "33""%s:%d"%("ab",3) => "ab:3"%字符:标记转换说明符的开始。在%的左侧放置一个字符串(格式化字符串),而 阅读全文
posted @ 2020-05-07 14:40 bwcheng 阅读(4237) 评论(0) 推荐(0)
摘要: import requestsheaders = { "Accept": "application/json, text/javascript, */*; q=0.01", "Content-Type": "application/x-www-form-urlencoded; charset=UTF 阅读全文
posted @ 2020-04-13 16:52 bwcheng 阅读(2477) 评论(0) 推荐(0)
摘要: 原文地址:https://www.cnblogs.com/liuzhzhao/p/12114453.html,感谢博主! 一. 用 requests.utils.dict_from_cookiejar() 把返回的cookies转换成字典 1. 处理cookies: 1 import request 阅读全文
posted @ 2020-04-13 16:47 bwcheng 阅读(28120) 评论(0) 推荐(0)
摘要: 一、默认参数 调用函数时,如果没有传递参数,则会使用默认参数。以下实例中如果没有传入 age 参数,则使用默认值: #可写函数说明 def printinfo( name, age = 35 ): "打印任何传入的字符串" print ("名字: ", name) print ("年龄: ", ag 阅读全文
posted @ 2020-03-11 11:04 bwcheng 阅读(374) 评论(0) 推荐(0)
摘要: 原文:https://www.cnblogs.com/jszfy/p/11148963.html 一、lambda语法: lambda argument_list: expression argument_list是参数列表,它的结构与Python中函数(function)的参数列表是一样的(输入) 阅读全文
posted @ 2020-03-11 10:39 bwcheng 阅读(376) 评论(0) 推荐(0)
摘要: 一、json模块,load和loads,dump和dumps根据序列化和反序列的特性总结 loads: 是将string转换为dictdumps: 是将dict转换为stringload: 是将里json格式字符串转化为dict,读取文件dump: 是将dict类型转换为json格式字符串,存入文件 阅读全文
posted @ 2020-03-10 15:36 bwcheng 阅读(140) 评论(0) 推荐(0)
摘要: 1、路由from flask import Flaskapp = Flask(__name__)# route() 装饰器把一个函数绑定到对应的 URL 上。ajax调用的时候就是对应这个地址@app.route('/')def index(): return 'index' if __name__ 阅读全文
posted @ 2020-01-04 15:02 bwcheng 阅读(220) 评论(0) 推荐(0)
摘要: 一、ajax获取的值赋值给外部变量 $('button').click(function(){ var list; $.ajax({ type: 'POST', async: false, //改成同步就可以把ajax获取的值赋值给外部变量 url: '/edit', //与edit相同都是得到对应 阅读全文
posted @ 2019-12-03 18:30 bwcheng 阅读(542) 评论(0) 推荐(0)