
python
文章平均质量分 52
ORACLE800
这个作者很懒,什么都没留下…
展开
-
python正则表达式一例
import res="name=z1hangshan username=fff url=www.baidu.com password=ddd256"p=re.compile(r'(^name)=(\S+)')#p=re.compile(r'(^name)=(\S+)')match=p.match(s)#if match:# print match.group(),match.gro原创 2012-12-22 23:18:16 · 601 阅读 · 0 评论 -
webpy注册登陆
index.py #coding=utf-8import webimport datetimefrom web import formweb.config.debug = Falseimport sysreload(sys)sys.setdefaultencoding( "utf-8" )urls=('/','Index', '/reg',原创 2013-08-30 15:48:39 · 5437 阅读 · 4 评论 -
文章表
drop table if exists t_articles ;create table t_articles(id int(10) primary key auto_increment comment '文章id' ,title varchar(20) not null comment '文章标题',writer varchar(20) not null comment '作者'原创 2013-08-30 17:33:08 · 1706 阅读 · 0 评论 -
webpy session 判断登陆示例,报错attributeError: 'ThreadedDict' object has no attribute
#报错原因 :缺少web.config.debug = False 这一句。import webweb.config.debug = Falseurls=('/login','Login','/logout','Logout',)#app=web.application(urls, locals());#if __name__ == '__mai原创 2013-08-13 15:20:39 · 5734 阅读 · 0 评论 -
web.py 的session 没法使用吗?
web.py 的session 没法使用吗?来自: 小罗快飞 2011-12-15 10:03:42 问题解决了,感谢 rosickey 的支持app_root = os.path.dirname(__file__)app = web.application(urls, globals()).wsgifunc()db = web.database(d转载 2013-08-23 17:34:56 · 2234 阅读 · 0 评论 -
json 的跨域调用 python代码示例
客户端: jQuery-跨域请求 jQuery(document).ready(function(){ $.ajax({ type : "GET", url : "http://10.13.38.43:1234/?id=10&ca原创 2013-08-23 17:02:00 · 4180 阅读 · 0 评论 -
webpy session 设置
import webweb.config.debug = Falseurls = ( "/count", "count", "/reset", "reset")app = web.application(urls, locals())session = web.session.Session(app, web.session.DiskStore('sessions'),原创 2013-08-07 09:55:16 · 2449 阅读 · 0 评论 -
webpy 简单表单一粒
# -*- coding: gbk -*-import webfrom web import formurls=('/jg','jg',)app=web.application(urls,globals())render = web.template.render('templates') # your templatesvweight = form.regexp(r"原创 2013-06-04 18:01:32 · 2442 阅读 · 0 评论 -
python 实例
#!/usr/bin/python#coding=gbkimport reimport sysimport subprocessimport osclass Mytool: #根据文件名读取文件内容 def getFileContent(self,filepath): if(os.path.exists(转载 2013-02-19 16:18:31 · 1387 阅读 · 0 评论 -
python 自动登陆 urllib urllib2 cookielib
#!/usr/bin/pythonimport urllibimport urllib2import cookieliburl='http://10.11.77.18:1234/login'values={'username':'zhangshan','password':'ok'}data = urllib.urlencode(values)headers ={"原创 2013-02-19 11:34:12 · 3671 阅读 · 0 评论 -
使用ajax判断用户是否已经存在,并提示。
使用ajax判断用户是否已经存在,并提示。 $(document).ready( function() { $("#username").blur(function()原创 2013-02-17 15:14:41 · 1895 阅读 · 0 评论 -
Python 拷贝对象(深拷贝deepcopy与浅拷贝copy)
import copya = [1, 2, 3, 4, ['a', 'b']] #原始对象b = a #赋值,传对象的引用c = copy.copy(a) #对象拷贝,浅拷贝d = copy.deepcopy(a) #对象拷贝,深拷贝a.append(5) #修改对象aa[4].append('c') #修改对象a中的['a', 'b']数组对象print转载 2013-02-06 14:19:40 · 962 阅读 · 0 评论 -
webpy 解决中文出现UnicodeDecodeError: 'ascii' codec can't decode byte 问题
学习webpy过程中,出现 UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 29: ordinal not in range(128) 错误百度之后参考如下文章解决:http://blog.sina.com.cn/s/blog_6c39196501013s5b.html解决Unicod转载 2013-02-02 11:15:00 · 32066 阅读 · 2 评论 -
web.py连接远程mysql
>>> db1=web.database(dbn='mysql', db='test', user='root',host='192.168.0.102',pw='123456')>>> print db1.select('t_article',where='id=121005103121014957' )0.0 (1): SELECT * FROM t_article WHERE id=原创 2013-02-02 12:19:55 · 4293 阅读 · 0 评论 -
mysql 连接命令
deployop@opensuse:~/wwwroot/userCenter> mysql -h 192.168.0.102 -P 3306 -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4Server v原创 2013-02-02 11:36:54 · 1134 阅读 · 0 评论 -
【Python】 Python:locals 和 globals
【Python】 Python:locals 和 globals2011-09-09 14:27 204人阅读 评论(0) 收藏 举报 静夜思 » 日志 » Python:locals 和 globals热1发表于2010-03-21 23:32 已有678人读过 标签: Python globals locals Pyth转载 2013-01-13 10:17:09 · 776 阅读 · 0 评论 -
python 正则表达式:匹配字符串开头并打印
import res="name=z1hangshan username=fff url=www.baidu.com password=ddd256"s2="username=fff name=z1hangshan url=www.baidu.com password=ddd256"#p=re.compile(r'((?:\s)name=(\S)+)')p=re.compile(r'(^原创 2012-12-22 22:52:54 · 3908 阅读 · 0 评论 -
python替换文件中的配置值
##将文本中的name=配置项值更新为name=newvalueimport reimport osp=re.compile(r'(^name)=(.+)')f=file('d://soft/list.txt','r')f2=file('d://soft/list3.txt','w')while True: line=f.readline() if len(line)==0:原创 2012-12-23 12:46:45 · 1294 阅读 · 0 评论 -
手机版html
http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">http://code.jquery.com/jquery-1.8.3.min.js">http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"> 欢迎来到我原创 2014-08-13 20:39:40 · 3676 阅读 · 0 评论