11 2017 档案

摘要:def deco(func): def _deco(request): reqFun=None try: loginbean = request.session['loginbean'] if loginbean == None: return HttpResponse("")... 阅读全文
posted @ 2017-11-18 16:11 时间影像 阅读(314) 评论(0) 推荐(0) 编辑
摘要:# -*- coding: utf-8 -*- from urllib.request import Request from urllib.request import urlopen #添加模拟浏览器协议头 headers = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/2... 阅读全文
posted @ 2017-11-13 20:43 时间影像 阅读(232) 评论(0) 推荐(0) 编辑
摘要:1.前台 上传身份证照片 个人手持身份证照片 {% csrf_token %} 2.后台 def writerApply(request): try: loginbean = request.session['loginbean'] ... 阅读全文
posted @ 2017-11-13 09:14 时间影像 阅读(135) 评论(0) 推荐(0) 编辑
摘要:http://www.jianshu.com/p/22af55518f6d //-----------------换将搭建---------------------------- 1.安装ruby C:\tools\redis\redis集群\ 勾三个勾 2.安装RubyGems 解压运行C:\tools\redis\redis集群\rubygems-2.5.1里面的 setup.rb 安装 ... 阅读全文
posted @ 2017-11-08 20:57 时间影像 阅读(206) 评论(0) 推荐(0) 编辑
摘要:内存数据库: 1.双击redis-server.exe =>启动 2.双击redis-cli.exe =>打开管理控制台 3.查看所有key keys * 4.查看key类型 type myKey 操作: 1.字符串类型: 创建和修改: set user 'zhangsan' 获得key的值 get user 删除键 ... 阅读全文
posted @ 2017-11-08 20:56 时间影像 阅读(179) 评论(0) 推荐(0) 编辑
摘要:前端:<form method="post" action="./userRegister"> {% csrf_token %} <input type="text" name="email" class="form-control" placeholder="用户名"><br> <input ty 阅读全文
posted @ 2017-11-06 21:05 时间影像 阅读(122) 评论(0) 推荐(0) 编辑
摘要:cursor.execute("insert into users set email=%s,pwd=%s,nicheng=%s,createtime=%s",(email,pwd,nicheng,time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))) python中时间日期格式化符号: %y 两位数的年份表示(00-9... 阅读全文
posted @ 2017-11-06 21:04 时间影像 阅读(854) 评论(0) 推荐(0) 编辑
摘要:新方法连mysql:1.先安装: pip install mysqlclient2.settings.py中 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # 或者使用 mysql.connector.django 阅读全文
posted @ 2017-11-06 21:04 时间影像 阅读(67) 评论(0) 推荐(0) 编辑
摘要:# -*- coding: utf-8 -*- import _thread from time import sleep, ctime def fun1(): sleep(2) print('aaaaaaaaaa') def fun2(): sleep(1) print('bbbbbbbbb') def main(): _thread.star... 阅读全文
posted @ 2017-11-06 21:03 时间影像 阅读(82) 评论(0) 推荐(0) 编辑
摘要:# encoding: UTF-8import re#match是否在起始位置找到point = re.match('www','www.runoob.com').span()print point#是否包含point = re.search('com', 'www.run.com.oob.com' 阅读全文
posted @ 2017-11-02 16:53 时间影像 阅读(132) 评论(0) 推荐(0) 编辑
摘要:#分支语句 x=0 if x>> for char in 'hello': print char >>> for ii in range(10): #输出0~9 print ii >>> for ii in range(1,11): #输出1到10 print ii >>> for ii in range(1,11,2): #range([star... 阅读全文
posted @ 2017-11-02 16:52 时间影像 阅读(119) 评论(0) 推荐(0) 编辑
摘要:# -*- coding: utf-8 -*- ''' 使用语法糖@来装饰函数,相当于“myfunc = deco(myfunc)” 但发现deco函数只在第一次被调用,且myfunc函数在第一次后又被多调用了一次 ''' def deco(func): print("before myfunc() called.") func() print(" aft... 阅读全文
posted @ 2017-11-02 16:51 时间影像 阅读(83) 评论(0) 推荐(0) 编辑
摘要:#函数: >>> def sum(a,b): return a+b >>> print sum(5,6) 全局变量 conn = None def openConn(): global conn #全局 aa = None def fun(): global aa #声明aa是全局变量 aa=99 fun() print aa #输出99 默认值 多个返... 阅读全文
posted @ 2017-11-02 16:50 时间影像 阅读(113) 评论(0) 推荐(0) 编辑
摘要:字符串与元组的区别 相同点:都不可改变。都可以进行切片。 不同点:字符串有很多方法 元祖可以包含字符串 类型不同。字符串是文本型,元祖是序列。 Python 字符串操作(截取/替换/查找/分割) # 例1:字符串截取 str = '12345678' print str[0:1] >> 1 # 输出str位置0开始... 阅读全文
posted @ 2017-11-02 16:49 时间影像 阅读(132) 评论(0) 推荐(0) 编辑
摘要:#分支语句 x=0 if x>> for char in 'hello': print char >>> for ii in range(10): #输出0~9 print ii >>> for ii in range(1,11): #输出1到10 print ii >>> for ii in range(1,11,2): #range([star... 阅读全文
posted @ 2017-11-02 16:49 时间影像 阅读(140) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示