下载文件Bottle文件下载还是使用static_file这个模块,只是多加了一个参数:download=True,还是看例子吧![root@jubottle]#catdownload.py
#!/usr/bin/envpython
#coding=utf-8
frombottleimportroute,run,view,static_file
@route(‘/download/<filename:path>‘)
defdo..
分类:
Web程序 时间:
2015-06-21 15:58:27
阅读次数:
589
要求用户输入用户名密码登陆成功显示欢迎信息输错三次后锁定流程图代码#coding:UTF-8
username_password_file=‘user_passwd.txt‘#存储用户名密码
f=file(username_password_file)
username_password={}
forlineinf.readlines():
line=line.split()
username_password[line[0]]=..
分类:
其他好文 时间:
2015-06-21 15:56:16
阅读次数:
144
[root@jubottle]#caterror.py
#!/usr/bin/envpython
#coding=utf-8
frombottleimportroute,run,error,abort,redirect
#访问页面出错,Bottle会显示一个默认的错误页面,提供足够的debug信息。你也可以使用error()函数来自定义你的错误页面
@error(404)
deferror404(error):
re..
分类:
其他好文 时间:
2015-06-21 15:55:58
阅读次数:
134
# -*- coding: utf-8 -*-
__author__ = 'xy'
#切片(slice)的扩展使用方法
#1 用步长索引来进行扩展的切片操作
# slice[1:2:3]其中第3个位置表示步长,默认为1
#简单的str翻转:
s = 'abcde'
print s[::-1]
# >>>'edcba'
#间隔一个字符取值:
print s[::2]
# >>>'ace'
...
分类:
编程语言 时间:
2015-06-21 13:12:43
阅读次数:
229
几种邮件的具体实施代码1、普通文本邮件普通文本邮件发送的实现,关键是要将MIMEText中_subtype设置为plain。首先导入smtplib和mimetext。创建smtplib.smtp实例,connect邮件smtp服务器,login后发送。 1 #coding: utf-8 2 ''' ...
分类:
编程语言 时间:
2015-06-21 11:46:30
阅读次数:
147
# -*- coding: utf-8 -*-
#
# def displayNumType(num):
# print num, 'is',
# if type(num) == type(0):
# print 'an integer'
# elif type(num) == type(0L):
# print 'a long'
# ...
分类:
编程语言 时间:
2015-06-21 09:27:03
阅读次数:
216
深度学习笔记1(卷积神经网络)
在看完了UFLDL教程之后,决定趁热打铁,继续深度学习的学习,主要想讲点卷积神经网络,卷积神经网络是深度学习的模型之一,还有其它如AutoEncoding、Deep Belief Network、Restricted Boltzmann Machine和sparse coding等。
在UFLDL教程中提到了针对大型图像的处理...
分类:
其他好文 时间:
2015-06-21 02:07:43
阅读次数:
955
# -*- coding: utf-8 -*-"""Created on Sat Jun 20 19:36:34 2015@author: chaofn"""import os"""这个程序的目的是将linux下/ifs/home/fanchao/Manesh_pdb目录中的所有文件(一共有215个...
分类:
编程语言 时间:
2015-06-20 23:24:49
阅读次数:
230
每个窗口都有自己的context,这里演示怎么配置context以及如何实现定时器...... #-*- coding:gbk -*-import pygletplatform=pyglet.window.get_platform()display=platform.get_default_disp...
分类:
其他好文 时间:
2015-06-20 22:03:37
阅读次数:
201
#coding:utf-8import urllib#######爬虫v0.1 利用urlib2 和 字符串内建函数####### 获取网页内容def getHtml(url): page = urllib.urlopen(url) html = page.read() retur...
分类:
编程语言 时间:
2015-06-20 20:51:01
阅读次数:
157