2019年4月19日
摘要: 1、raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__) django.core.exceptions.ImproperlyConfigur 阅读全文
posted @ 2019-04-19 09:43 guodashen 阅读(283) 评论(0) 推荐(0)
  2018年5月11日
摘要: # from wsgiref.simple_server import make_server## def RunServer(environ,start_response):# start_response(status='200 OK',headers=[('Content-Type','tex 阅读全文
posted @ 2018-05-11 17:45 guodashen 阅读(157) 评论(0) 推荐(0)
  2018年5月9日
摘要: # 1、面向对象不是所有的情况都适用# 2、面向对象编程# a.定义类# class Foo:# def 方法1(self,bb):# b.根据类创建对象(创建)# class Person():# def __init__(self,name,age):# print(name)# #print( 阅读全文
posted @ 2018-05-09 17:15 guodashen 阅读(107) 评论(0) 推荐(0)
  2018年5月3日
摘要: import shutil#功能是将db文件中的内容拷贝到haha这个文件中去,但是haha原有的内容会被清空#shutil.copyfileobj(open('db','r',encoding='utf-8'),open('haha','w',encoding='utf-8'))#将db文件中的所 阅读全文
posted @ 2018-05-03 11:27 guodashen 阅读(103) 评论(0) 推荐(0)
摘要: #生成器函数,一个函数里如果有yield,这个函数就变成生成器函数了,主要用于保存工作状态的左右def xrange(): print(1) yield 1 print(2) yield 2 print(3) yield 3 print(4) yield 4 print(5) yield 5#仅获取 阅读全文
posted @ 2018-05-03 11:26 guodashen 阅读(91) 评论(0) 推荐(0)
  2018年5月1日
摘要: #第三方模块#1.安装#软件管理工具pip3#pip3添加到环境变量#pip3 install requests#2、源码安装#下载代码,安装#首先得进入到下载的文件夹的目录下,安装命令python setup.py install即可进行安装import requests#1.json#如何安装第 阅读全文
posted @ 2018-05-01 20:38 guodashen 阅读(115) 评论(0) 推荐(0)
  2018年4月30日
摘要: # from urllib import request## f=request.urlopen("http://123.178.101.29:81/xs_main.aspx?xh=201512102028")## result=str(f.read(),encoding='gb2312')# pr 阅读全文
posted @ 2018-04-30 11:06 guodashen 阅读(154) 评论(0) 推荐(0)
摘要: #字符串#老式的字符串格式化%,按照顺序 例如:# s="i am %s ,age %d"%('alex',18)# print(s)#加号表示右对齐,减号表示左对齐,如果是0的话,必须是数字即%04d# s="i am %(n1)+10s,age %(n2)+10d"%{"n1":'alex',' 阅读全文
posted @ 2018-04-30 08:49 guodashen 阅读(100) 评论(0) 推荐(0)
  2018年4月28日
摘要: 数据类型的获取type()函数、isinstance()函数 join 连接字符串 方法"_".join("要加的字符串");ljust 内容左对齐,右侧填充lower 把字符串变小写lstrip 移除右边的空格rstrip 移除右边的空格strip 移除所有的空格replace 替换s.repla 阅读全文
posted @ 2018-04-28 19:07 guodashen 阅读(149) 评论(0) 推荐(0)
摘要: 模块sys模块(和解释器相关的模块) 模块之导入模块: import sys sys.path.append("D:"); for i in sys.path: print(i) 模块之os模块(和系统相关的模块) import osstr1='D:'str2='home'str3='index't 阅读全文
posted @ 2018-04-28 18:51 guodashen 阅读(83) 评论(0) 推荐(0)