会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
中南毛毛虫
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
2021年1月9日
ORM-添加/删除/修改表记录(编辑)
摘要: 一、添加表记录 创建方式1: from django.shortcuts import render from homework1 import models def index(request): #book_obj自定义类对象 book_obj = models.BookInfo( id=2,
阅读全文
posted @ 2021-01-09 11:43 中南毛毛虫
阅读(165)
评论(0)
推荐(0)
2020年11月21日
杂碎内容整理
摘要: 查看模块下的所有方法 dir(模块名/包名) 例如: import os import multiprocessing print(dir(os)) print(dir(multiprocessing))
阅读全文
posted @ 2020-11-21 19:05 中南毛毛虫
阅读(64)
评论(0)
推荐(0)
2020年11月16日
json和pickle模块相关知识总结
摘要: 一、json模块 作用:将内置的数据类型,如int\tuple\list\dic(set, class不行),进行序列化或反序列化 dumps\loads方法主要用于网络传输,有时也用来读取文件。用于一般数据结构数据与json字符串相互转换 import json # 1.将一般数据结构转化成jso
阅读全文
posted @ 2020-11-16 21:19 中南毛毛虫
阅读(67)
评论(0)
推荐(0)
魔法方法总结
摘要: 一、__call__方法 class A(): def __call__(self, *args, **kwargs): print("我的名字叫做中南毛毛虫") # 于是便可以进行以下的操作: mkc = A() mkc() A()() 二、__len__方法 class Class(): def
阅读全文
posted @ 2020-11-16 16:48 中南毛毛虫
阅读(99)
评论(0)
推荐(0)
2020年11月15日
反射的用法总结
摘要: 一、反射对象的实例变量/绑定方法 import time class Perosn(): def __init__(self, name, birth): self.name = name self.birth = birth @property def age(self): return time
阅读全文
posted @ 2020-11-15 20:56 中南毛毛虫
阅读(91)
评论(0)
推荐(0)
python中转码先关内容整理
摘要: 1、unicode、utf-8、gbk之间的相互转换 aa = '今天的天气是多云' # utf-8到Unicode b = aa.encode('utf-8') print(b) # Unicode到utf-8 c = b.decode('utf-8') print(c) # Unicode到gb
阅读全文
posted @ 2020-11-15 09:45 中南毛毛虫
阅读(41)
评论(0)
推荐(0)
2020年11月11日
os模块的相关知识整理总结
摘要: 一、os.path相关 os.path.join(path, str)--拼接路径 os.path.isdir(path)--判断是不是文件夹 os.path.isfile(path)--判断是不是文件 os.path.dirname(file) --当前文件目录的父目录 os.path.getsi
阅读全文
posted @ 2020-11-11 19:28 中南毛毛虫
阅读(147)
评论(0)
推荐(0)
re模块相关内容记录与整理
摘要: import re exp = '<mkc>hajsdbfjkasnfk&*jnfkjgkjdfngj</mkc>89645860ghidngkj&()gd4</666>' # 1. 分组优先显示,针对于findall ret1 = re.findall('<\w+>(.*?)</\w+>', ex
阅读全文
posted @ 2020-11-11 16:29 中南毛毛虫
阅读(75)
评论(0)
推荐(0)
上一页
1
2
公告