随笔分类 - 笔记
摘要:windows ping 带时间戳 </h1> <div class="clear"></div> <div class="postBody"> <div id="cnblogs_post_description" style="display: none"> windows ping 时间戳 </
阅读全文
摘要:修改接口trunk为access模式有2种方式: 第一种: 直接清除此接口的配置,重新设置 clear con int g0/0/0 第二种: [Huawei]int g0/0/3 [Huawei-GigabitEthernet0/0/3]undo port trunk allow-pass vla
阅读全文
摘要:
阅读全文
摘要:目录结构 配置celery 创建任务 启动woker:celery -A celery_task worker -l info -P eventlet 自动添加任务:celery -A celery_task beat -l info
阅读全文
摘要:from django.db.models.fields import FieldDoesNotExist 错误代码如下: Traceback (most recent call last): File "../../manage.py", line 15, in execute_from_comm
阅读全文
摘要:# 封装 # 对外部隐藏具体的实现细节, 只提供简单的调用接口, 如USB接口 # 在类中, 用双下划线, 封装属性或方法, 外部不能调用, 不能继承 # 例: def __test(self): # 私有方法 pass __name = 'lee' # 私有属性 # 继承 # 将一些共同代码抽取成
阅读全文
摘要:global 定义一个或多个全局变量 globals() 存储所有全局变量 locals() 存储当前局部区域内,所有局部变量及方法 nonlocal 定义一个在闭包函数内,内部函数引用外部函数的属性 def outer(): n = 1 def inner(): nonlocal n n=2 pr
阅读全文
摘要:# 解压赋值 a,b = (1,2) print(a,b) # 1 2 # 交叉赋值 a = 1 b = 2 a,b = b,a print(a,b) # 2 1 # 按指定条件给字典排序 test = {'a':1,'b':3,'c':2} res = dict(sorted(test.items
阅读全文
摘要:# zip 将两个列表,对应位置的值拼接成元组,最后结果是一个列表套元组,注:不对应的值,会被舍弃. l1 = [1,1,3,6,7] l2 = [1,2,3,4] print(list(zip(l1,l2))) # [(1, 1), (2, 2), (3, 3), (6, 4)] # filter
阅读全文
摘要:修改头像 ajax上传图片,必须创建FormDate(),然后把图片加进去. ajax上传图片 $('#id_set_avatar_submit').click(function () { avatar_img = $('#id_avatar')[0].files[0]; var formData
阅读全文
摘要:from django.db import models from django.contrib.auth.models import AbstractUser # Create your models here. # 用户表 class UserInfo(AbstractUser): phone
阅读全文
摘要:# 在ORM中设置自关联字段 class Comment(models.Model): user = models.ForeignKey(to='UserInfo') article = models.ForeignKey(to='Article') content = models.CharFie
阅读全文
摘要:# 修改settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'test', 'HOST':'127.0.0.1', 'PORT':3306, 'USER':'root', 'PASS
阅读全文
摘要:深浅拷贝 深浅copy 先问问大家,什么是拷贝?拷贝是音译的词,其实他是从copy这个英文单词音译过来的,那什么是copy? copy其实就是复制一份,也就是所谓的抄一份。深浅copy其实就是完全复制一份,和部分复制一份的意思。 1,先看赋值运算。 l1 = [1,2,3,['jason','ego
阅读全文