随笔分类 - python
摘要:https://www.nhooo.com/note/qa3v7f.html 通常我们会用到过滤两个时间段内的一些数据, 当我们用django rest framework的时候, 他可以根据字段filter_fields进行过滤, 但是对于日期来说并不起作用, 这个时候就需要我们设置重写query
阅读全文
摘要:问题: USE_TZ = False后,django orm 查询时间报错:MySQL backend does not support timezone-aware datetimes when USE_TZ is False. 解决: 查询时间前,做替换 import pytz from dja
阅读全文
摘要:#遍历字典, 分别打印key, value, key:value emp = {'name':'Tom', 'age':20, 'salary' : 8800.00} for k in emp.keys(): print('key = {}'.format(k)) for v in emp.valu
阅读全文
摘要:Promise.all([ request({ url: urlPrefix_custom, method: 'get', params: querys }) ]).then((res)=>{ console.log(" 自定义事件详情数据导出,回调数据 ") console.log(res[0].
阅读全文
摘要:获取带参数URL:request.get_all_path() 获取不带参数URL:request.path 获取主机地址:request.get_host()
阅读全文
摘要:// 读取本地json文件 export function GetUserAction (query){ let quesa = axios.get('/json/userAction.json').then(res => { // 获取public下的buildmenu.json文件数据 cons
阅读全文
摘要:数据打印格式: VUE部分: <div style="height:80vw;"> <el-table :data="resultTable.slice((queryInfo.pagenum-1)*queryInfo.pagesize,queryInfo.pagenum*queryInfo.page
阅读全文
摘要:1·vue获取路径传值 getEqRequest (query) { query = { data_point_app_id: this.$route.query.data_point_app_id, data_point_app_name: this.$route.query.data_point
阅读全文
摘要:浮点型时间格式转换: GMT_FORMAT = '%Y-%m-%d %H:%M:%S' ta = str(w['create_datetime']).split(".")[0] create_datetime = datetime.datetime.strptime(ta, GMT_FORMAT)
阅读全文
摘要:代码: if user_actions_name: # 获取自定义事件详情 print(' 自定义事件名 ') print(user_actions_name) new_custom_item = [] for w in data: custom_name = json.loads(w['custo
阅读全文
摘要:from dvadmin.utils.json_response import SuccessResponse return SuccessResponse(data=new_custom_item, msg="获取成功")数据格式为: [{'名字': '韩梅梅'}, {'动作': '跳舞'}, {
阅读全文
摘要:def get(self, request): print(" 用户行为列表") dictionary_key = self.request.query_params.get('data_point_app_id') print(' 445 ') print(dictionary_key) if d
阅读全文
摘要:print(pse) # b'{"prepay_id":"wx1013363030599843f9ee87f742426e0000"}'pses = pse.json()now_data['package'] = "prepay_id=" + pses['prepay_id'] #拿取per***_
阅读全文
摘要:Python中request请求得到的response,即通过request得到的数据: import requests response = requests.get("https://www.jd.com/") 具体参考这篇:https://blog.csdn.net/qq_29027865/a
阅读全文
摘要:POST方式: if request.method == 'POST': body_str = request.body.decode('utf-8') post_data = parse_qs(body_str) post_dict = {} for k, v in post_data.items
阅读全文
摘要:request.GET.get接收的是空字典。 处理办法: data_json = json.loads(request.body) product = data_json.get('product')
阅读全文
摘要:vue上服务器后因为插件原因报错: AttributeError: ‘str‘ object has no attribute ‘decode‘ 解决办法: str.encode('utf-8').decode('utf-8')
阅读全文
摘要:nohup python manage.py runserver 0.0.0.0:80 > run.log 2>&1 &通过ps -ef |grep python获取Python进程号然后kill - 9进程号查看进程: ps -ef|grep "python"杀死进程: kill -9 3435
阅读全文
摘要:使用 netstat 命令时提示没有权限访问,添加可执行权限也被拒绝,这种情况下可执行如下命令解决: lsattr /usr/bin/netstatchattr -i /usr/bin/netstatlsattr /usr/bin/netstatll /usr/bin/netstatchmod 75
阅读全文
摘要:查看进程 ps -ef |grep python 关闭进程 kill -9 26879 linux下后台执行某个python脚本 nohup python -u xxx.py > out.log 2>&1 &
阅读全文

浙公网安备 33010602011771号