- 博客(58)
- 收藏
- 关注
原创 springframework
1、什么是spring2、配置文件管理3、基于注解的di3.1component3.2repository service controller多注解项目分层3.3扫描多个包的方式3.4@value
2022-01-03 23:24:54
155
原创 spring
一、容器1、FileSystemXmlApplicationContext:该容器从 XML 文件中加载已被定义的 bean。在这里,你需要提供给构造器 XML 文件的完整路径。2、ClassPathXmlApplicationContext:该容器从 XML 文件中加载已被定义的 bean。在这里,你不需要提供 XML 文件的完整路径,只需正确配置 CLASSPATH 环境变量即可,因为,容器会从 CLASSPATH 中搜索 bean 配置文件。3、WebXmlApplicationConte
2022-01-03 16:24:33
135
原创 jquery文档处理
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>文档处理</title></head><body><input type="text" value="123"><input type="checkbox" name="hobby"><div id="outer"&g.
2020-10-04 23:34:12
95
原创 jquery操作元素(属性 CSS 和 文档处理)
$("p").text() //获取text值 $("p").html() //获取整个html值 $(":checkbox").val() $(".test").attr("alex") //获取alex的属性值 $(".test").attr("alex","sb") //设置alex这个属性的值胃sb $(".test").attr("checked","checked") $(":checkbox").removeAttr("checked") //移除att...
2020-10-04 16:04:32
88
原创 jquery筛选器
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>筛选器</title></head><body><div class="div1">hello1 <div class="div2">hello2 <div class="div3" id="te.
2020-10-03 17:43:46
155
原创 jquery选择器
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>选择器</title></head><body><div> hello div</div><div class="div1">hello div1 <ul> <li>.
2020-09-26 23:21:40
83
原创 监听函数的实现方法
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>onsubmit</title></head><body><form onsubmit="return check(event)"> 姓名: <input type="text" name="name"> .
2020-07-31 16:20:23
559
原创 history类
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>history1</title></head><body> <input type="button" value="前进" onclick="func1()"> <a href="history2.html">hi.
2020-05-25 15:21:19
183
原创 windows函数
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Window</title></head><body><input type="text" width="249px" id="clock"><input type="button" value="begin" onclick="b.
2020-05-25 11:55:51
309
原创 Math
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Math</title></head><body></body><script>alert(Math.random()); //返回[0,1)的任何一个随机数alert(Math.round(3.3));//四舍五入al.
2020-05-21 22:15:56
172
原创 RegExp
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>regexp</title></head><body></body><script> //第一种生成方式 var r1 = new RegExp("\d+","g"); alert(r1.test("1.
2020-05-20 23:13:58
190
原创 javascript -Array
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Array</title></head><body></body><script> //第一种生成方式 var a1 = [1, 'hello', 3]; //第二种生成方式 var a2=ne.
2020-05-20 11:24:30
253
原创 javascript--switch if for 及function
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>javascript</title></head><body></body><script>var x = 2;switch (x){ case 1:y="星期一"; break; case 2:y="星期.
2020-05-17 17:19:01
297
原创 查看linux的cpu
注意:总逻辑CPU数 = 物理CPU个数 * 每颗物理CPU的核数 * 超线程数查询CPU个数:cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l查询核数:cat /proc/cpuinfo| grep "cpu cores"| uniq查询逻辑CPU总数:cat /proc/cpuinfo| ...
2019-12-13 15:31:37
124
原创 xml处理
https://www.cnblogs.com/hupeng1234/p/7262371.import xml.etree.ElementTree as ETtree = ET.parse("D:\store.txt")root = tree.getroot()dataDict = {}for child in root: print(child.tag) tempL...
2019-09-07 23:20:19
81
原创 测试脚本1
import jsonwith open("D:\store.txt", "r", encoding="utf-8") as f: data = json.loads(f.read())print(len(data))dataDict = {}for item in data: tempList = [] tempList.append(item['comp...
2019-09-05 23:20:47
83
原创 Json中的几个方法
from rest_framework.renderers import JSONRendererfrom rest_framework.parsers import JSONParser1、JSONRenderer().render(serializer.data)将ReturnDict字典类型转换为字节流snippet = Snippet(owner=user,code='foo...
2019-08-23 09:37:55
600
原创 python的运算符
a = 76b = 10print(a/b) #7.6print(a%b) #6print(a//b) #7#这里的数值是以补码的形式表示的c = 1d = 11e = (-1)print(c&d) #1print(d&e) # 11print(c&e) #1f = 60g = 13print(f&g) #12print(~g) ...
2019-08-21 17:38:45
335
原创 生成器中的send
import timedef foo(): print("******start*****") print("this is the first line") r1 = yield 'r1' print("this is the second value:%s" % r1) r2 = yield 'r2' print("this is the...
2019-08-16 16:29:49
119
原创 深浅拷贝
# import copy# a=[[1, 2], 3, 4]# b=copy.copy(a)## print('浅拷贝浅拷贝浅拷贝')# print('a:%s'%id(a))# print('b:%s'%id(b))# print('a[0]%s'%id(a[0]))# print('b[0]%s'%id(b[0]))# print('a[0][0]%s'%id(a[0][...
2019-06-11 16:14:19
108
原创 __new__() __init__方法
__new__方法是用来生成实例的__new__主要用来定制化不可变类对象,#__new__的使用class Test: def __new__(cls): if not hasattr(cls, 'instance'): cls.instance=super(Test, cls).__new__(cls) retu...
2019-05-16 15:59:39
525
原创 算法题
from django.test import TestCase # Create your tests here.### a = '2'# b=True# l = [1,4,5]# s = {'a':6, 'b':7}# s1 = {'2','3'}#### def f(b):# b=False# print(b)## f(b)# print...
2019-05-08 00:08:21
123
原创 Django ORM
def show(req): #新增记录两种方式,create save # #-------------------create # models.Authors.objects.create(name='jiangqijun') # models.Authors.objects.create(**{'name':'xiaoming'}) # #----...
2019-05-06 23:40:55
125
原创 html1
<html><head><!--<meta http-equiv='Refresh' content="2;URL='https://www.baiu.com">--><link rel='icon' href='http://www.jd.com/favicon.ico'><title>form表单</tit...
2019-04-05 22:44:02
75
原创 subprocess
import subprocess#print(subprocess.check_output("mkdir test4", shell=True).decode('gbk')) #当执行结果为0的时候直接返回值,如果不为0则报错#print(subprocess.call('cd ..', shell=True))#执行成功返回0执行失败返回1#subprocess.Popen():...
2019-03-29 17:32:34
547
原创 time模块
import timeprint(time.time()) #时间戳1553828380.9501994print(time.localtime(1553828380.9501994))#time.struct_time(tm_year=2019, tm_mon=3, tm_mday=29, tm_hour=10, tm_min=59, tm_sec=40, tm_wday=4, tm_yda...
2019-03-29 15:02:22
351
原创 routers
一、视图集from rest_framework import viewsetsfrom snippets.models import Snippetfrom django.contrib.auth.models import Userfrom snippets.serializers import SnippetSerializer,UserSerializerfrom rest_...
2019-03-21 15:35:02
206
原创 HyperlinkedModelSerializer
一、序列化器,继承HyperlinkedModelSerializer,分别添加url以及highlighted字段,建立snippets = serializers.HyperlinkedRelatedField关系class SnippetSerializer(serializers.HyperlinkedModelSerializer): owner = serializers...
2019-03-21 11:39:23
1735
原创 permissions
1、在model表中添加用户userowner = models.ForeignKey('auth.User', related_name='snippets', on_delete=models.CASCADE)2、在序列化表中添加如下关联信息对应表owner = serializers.ReadOnlyField(source='owner.username')用户表...
2019-03-21 09:29:59
448
原创 ListCreateAPIView,RetrieveUpdateDestroyAPIView
from snippets.models import Snippetfrom snippets.serializers import SnippetSerializerfrom rest_framework import genericsclass SnippetList(generics.ListCreateAPIView): queryset = Snippet.obje...
2019-03-20 20:30:02
1393
原创 Djiango-restframwork-mixins
from snippets.models import Snippetfrom snippets.serializers import SnippetSerializerfrom rest_framework import mixinsfrom rest_framework import generics"""我们使用GenericAPIView构建了我们的视图,并且用上了ListM...
2019-03-20 20:21:24
211
原创 Djiangop-restframwork-APIView
# class Snippets_list(APIView):# def get(self, request, format=None):# snippet = Snippet.objects.all()# serializer = SnippetSerializer(snippet, many=True)# return Resp...
2019-03-20 19:37:26
239
原创 python3编码问题
"""编码问题在python3中只有两种数据类型1、str:编码形式是unicode,unicode任一字符编码都存在2、bytes:编码形式是十六进制"""#编码encoding#utf, gbk都只是一种编码规则,按照各自的规则进行编码,可以存在多种编码规则s = 'hello中国' #在内存中是以unicode编码存储的,这是unicode编码#str--->>...
2019-03-05 23:28:50
142
原创 Content-Type: multipart/form-data; boundary=33dde4791cfce43a7aa122d93ab066dc requests.post()
使用requests.post方法请求Content-Type: multipart/form-data格式的接口,今天试了很多次都跟实际接口的请求不一致,传入的数据格式对不上,主要原因是在headers头中不用再传入Content-Type: multipart/form-data,具体见例子1、传入的参数每个字段以元祖的格式保存parm2 ={ "occur_time": (...
2019-03-03 15:43:57
10027
原创 Exception
#__author__:jiangqijun#__date__:2019/2/24#__date__:2019/2/24class MyException(Exception): def __init__(self,message): self.message = message def __str__(self): return sel...
2019-02-24 13:01:41
169
原创 threading
一、线程的函数式定义,join setDaemon方法的使用import timefrom threading import Threadbegin =time.time()def foo(): print("this is foo1") time.sleep(2) print("end foo1")def bar(): print("this ...
2019-02-24 11:34:47
177
原创 pipenv 安装包遇到的坑
前两天晚上拉了项目下来安装虚拟环境包执行pipenv install 时一直报下面的错误Could not fetch URL https://pypi.python.org/simple/: connection error: HTTPSConnectionPool(host='pyp ② Could not find a version that satisfies the requi...
2019-02-19 10:00:24
4545
2
原创 类(二)
一、修饰符 公有成员 私有成员, __字段名 - 无法直接访问,只能间接访问class Foo: __address = 'hunan' def __init__(self, name): self.name = name self.__age = 18 #无法直接访问 @static...
2019-02-09 11:19:13
134
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人