上一页 1 ··· 9 10 11 12 13
摘要: #!/usr/bin/env python # -*- coding:utf-8 -*- from threading import Thread import time from Queue import Queue import random class Producer(Thread): de 阅读全文
posted @ 2016-03-09 17:37 fengjian1585 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 1.io密集型使用多线程 2.大数据分析(计算型)使用多进程 阅读全文
posted @ 2016-03-09 14:10 fengjian1585 阅读(96) 评论(0) 推荐(0) 编辑
摘要: server.py #!/usr/bin/env python # -*- coding:utf-8 -*- import SocketServer import os class MySocketServer(SocketServer.BaseRequestHandler): def handle 阅读全文
posted @ 2016-03-09 11:11 fengjian1585 阅读(580) 评论(0) 推荐(0) 编辑
摘要: http 错误代码表 所有 HTTP 状态代码及其定义。 代码 指示 2xx 成功 200 正常;请求已完成。 201 正常;紧接 POST 命令。 202 正常;已接受用于处理,但处理尚未完成。 203 正常;部分信息 — 返回的信息只是一部分。 204 正常;无响应 — 已接收请求,但不存在要回 阅读全文
posted @ 2016-03-09 10:53 fengjian1585 阅读(167) 评论(0) 推荐(0) 编辑
摘要: os.getcwd() 获取当前工作目录,即当前python脚本工作的目录路径 os.chdir("dirname") 改变当前脚本工作目录;相当于shell下cd os.curdir 返回当前目录: ('.') os.pardir 获取当前目录的父目录字符串名:('..') os.makedirs 阅读全文
posted @ 2016-03-08 14:41 fengjian1585 阅读(269) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python #-*- coding:utf-8 -*- import SocketServer class MySocker(SocketServer.BaseRequestHandler): def handle(self): print self.request, 阅读全文
posted @ 2016-03-08 10:59 fengjian1585 阅读(166) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python #-*- coding:utf-8 -*- from day5 import conf import MySQLdb class MysqlHepler(object): def __init__(self): self.conn = MySQLdb.co 阅读全文
posted @ 2016-03-07 17:16 fengjian1585 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 配置 glusterfs 配置 volume GlusterFS中的volume的模式有很多中,包括以下几种: 分布卷(默认模式):即DHT, 也叫 分布卷: 将文件已hash算法随机分布到 一台服务器节点中存储。 复制模式:即AFR, 创建volume 时带 replica x 数量: 将文件复制 阅读全文
posted @ 2016-03-07 15:42 fengjian1585 阅读(727) 评论(0) 推荐(0) 编辑
摘要: Linux 安装mysql: apt-get install mysql-server 安装python-mysql模块:apt-get install python-mysqldb Windows 下载安装mysql python操作mysql模块:MySQL-python-1.2.3.win32 阅读全文
posted @ 2016-03-07 15:21 fengjian1585 阅读(152) 评论(0) 推荐(0) 编辑
摘要: import MySQLdb conn = MySQLdb.connect(host='172.16.202.182',user='fengjian',passwd='123456',db='fengjian') cur = conn.cursor() sql = 'insert into admi 阅读全文
posted @ 2016-03-07 11:39 fengjian1585 阅读(141) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python # -*- coding:utf-8 -*- class Provice: momo = '中国很好' #静态字段 #构造函数 def __init__(self,name,age,salary,flag): self.Name = name self.A 阅读全文
posted @ 2016-03-07 10:47 fengjian1585 阅读(165) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python # -*- coding:utf-8 -*- ''' from backend import account account.login() account.logout() import backend.account backend.account.l 阅读全文
posted @ 2016-03-07 09:55 fengjian1585 阅读(125) 评论(0) 推荐(0) 编辑
摘要: import random #print random.random() #0.522622274753 #print random.randint(1,5) 生成1-5之间的一个随机整数 #print random.randrange(1,3) 生成1-2之间的一个随机整数 阅读全文
posted @ 2016-03-06 21:53 fengjian1585 阅读(149) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python#_*_ coding:utf-8 _*_temp = 'mysqlhelper'func = 'count'modle = __import__(temp)Function = getattr(modle,func) #如果模块中找到字符串,返回函数pri 阅读全文
posted @ 2016-03-06 21:15 fengjian1585 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 主程序, #!/usr/bin/env python #_*_ coding:utf-8 _*_ import pickle import os import sys import time import pickle dirname = os.path.dirname(os.path.dirnam 阅读全文
posted @ 2016-03-05 23:36 fengjian1585 阅读(199) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python # -*- coding:utf-8 -*- def auth(func): def wrapper(): user = raw_input('input name: ').strip() if user == 'alex': print '------- 阅读全文
posted @ 2016-03-04 17:45 fengjian1585 阅读(114) 评论(0) 推荐(0) 编辑
摘要: import re listall = "adkr20xcv3\actad4/" result = re.search('\w+',listall) print result.group() print '------------------>' print re.findall('[a-zA-Z] 阅读全文
posted @ 2016-03-04 14:26 fengjian1585 阅读(129) 评论(0) 推荐(0) 编辑
摘要:     阅读全文
posted @ 2016-03-02 11:26 fengjian1585 阅读(325) 评论(0) 推荐(0) 编辑
摘要: #!/usr/bin/env python # -*- coding:utf-8 -*- import os,sys num_count = 0 lock_file = 'lockfile.txt' account_file = 'account.txt' match_flag ='' def lo 阅读全文
posted @ 2016-01-28 16:47 fengjian1585 阅读(265) 评论(0) 推荐(0) 编辑
摘要: print cmp(2,3) print cmp(2,2) print cmp(3,2) abs(-1) print bool(0) print bool(-1) False print bool('') False print divmod(3,2) print min([11,22,33,44]) #必须是列表 print max([11,22,33,44]... 阅读全文
posted @ 2016-01-25 11:35 fengjian1585 阅读(304) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13