随笔分类 -  python

摘要:import re str = "Iss study Python3.6 Everyday" # 1. ^ :开头 result = re.match("^I",str) # I print(result.group()) # 2. . : 任意字符 result = re.match("^I.", 阅读全文
posted @ 2019-01-22 18:03 fangsheng420 阅读(142) 评论(0) 推荐(0)
摘要:1、下载: https://docs.geetest.com/install/deploy/server/java 2、解压文件夹: 3、项目中国需要导入gt.js和两个jar包: 4、demo1和的demo2分别是两个demo,demo1是点字,demo2是滑动: 阅读全文
posted @ 2018-10-28 09:49 fangsheng420 阅读(230) 评论(0) 推荐(0)
摘要:# 1、datetime 一些常用的 import datetime now = datetime.datetime.now() # 当前时间 2018-10-22 17:34:10.665324 print(now) today = datetime.date.today() # 今天的年月日 2018-10-22 print(today) ... 阅读全文
posted @ 2018-10-22 18:41 fangsheng420 阅读(120) 评论(0) 推荐(0)
摘要:1、下载 2、解压 目录结构: 3、将code的highcharts.js 和 code\modules的exporting.js引入html中,可以不要jquery.js 4、html代码: 5、效果: 阅读全文
posted @ 2018-10-21 15:05 fangsheng420 阅读(294) 评论(0) 推荐(0)
摘要:strs="fs_lwy_ws" # 从左边开始截取 print(strs.split("_")) # ['fs', 'lwy', 'ws'] # 从右边开始截取 print(strs.rsplit("_")) # ['fs', 'lwy', 'ws'] # 从右边开始截取 ,截一次 print(strs.rsplit("_",1)) # ['fs_lwy', 'ws'] # 从左边开.. 阅读全文
posted @ 2018-10-21 11:55 fangsheng420 阅读(103) 评论(0) 推荐(0)
摘要:1、一个Q: 2、多个Q: 3、Q里面的字段可以用下划线: 4、gt大于等于 ~Q就是非的意思: 5、Q.children.append()和Q.add(): 阅读全文
posted @ 2018-10-17 22:01 fangsheng420 阅读(197) 评论(0) 推荐(0)
摘要:1.解压下载的压缩包: 2.将js,swf、xml和png文件导入项目中: 导入后的文件目录: 3、引入文件: 阅读全文
posted @ 2018-10-17 20:28 fangsheng420 阅读(514) 评论(0) 推荐(0)
摘要:点击课程标签,去除该课程: 阅读全文
posted @ 2018-10-13 16:15 fangsheng420 阅读(1415) 评论(0) 推荐(0)
摘要:window.open是用来打开一个新窗口的;window.opener是调用父级窗口 举个栗子: 1.index.html页面: 2. /addBook 所跳转的页面 addbook.html 3. views.py 提交所执行的后台代码: 4.pop.html页面:相当于 信息传递的载体<!DO 阅读全文
posted @ 2018-10-11 17:19 fangsheng420 阅读(2211) 评论(0) 推荐(0)
摘要:dict是字典对象,没有urlencode()方法; QueryDict对象,有urlencode()方法,作用是将QueryDict对象转换为url字符串; 一般QueryDict通过params = copy.deepcopy(request.GET)得到的,这时params是QueryDict 阅读全文
posted @ 2018-10-10 20:57 fangsheng420 阅读(1204) 评论(0) 推荐(0)
摘要:1、首先要下载BeautifulSoup: pip3 install BeautifulSoup4 2、 from bs4 import BeautifulSoups = '''<html><head><title>The Dormouse's story</title></head><body>< 阅读全文
posted @ 2018-10-08 20:12 fangsheng420 阅读(163) 评论(0) 推荐(0)
摘要:#########################聚合#################################查询所有书籍的价格和 字典ret = Book.objects.all().aggregate(price_sum=Sum("price"))print(ret) # 查询所有作者 阅读全文
posted @ 2018-10-06 17:26 fangsheng420 阅读(161) 评论(0) 推荐(0)
摘要:#########################基于对象查询(子查询)############################ 按字段(publish) 1) 一对多 : book > publish < book_set.all() 正向查询按字段:查询python这本书籍的出版社的邮箱 pyt 阅读全文
posted @ 2018-10-06 14:37 fangsheng420 阅读(91) 评论(0) 推荐(0)
摘要:1、在app中创建templatetags模块(必须的)2、创建任意 .py 文件,如:myTag.py3、myTag.py文件:from django import templatefrom django.utils.safestring import mark_saferegister = te 阅读全文
posted @ 2018-10-04 21:12 fangsheng420 阅读(520) 评论(0) 推荐(0)