python Quicksort demo】的更多相关文章

__author__ = 'student' ''' quicksort step 1, choose one pivot, such as pivot=la[0] step 2, scan the data from right side, find data less than pivot, then swap this with pivot pivot=1 [4] 5 7 3 20 9 [j] then scan from left side, find data greater than…
I did a demo about how to deploy other python apps served by a 'supervisord' daemon processor on github. Here is the link. http://github.com/xros/supervisord_start_all There are serveral torando apps there. Here's a brife introduction of one of the t…
python RSA+MD5签名demo: #!/usr/bin/env python2.7 #coding:utf-8 import base64 from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1_v1_5 from Crypto.Hash import SHA,MD5 TEST_PRIKEY='''-----BEGIN RSA PRIVATE KEY----- MIIBVAIBADANBgkqhkiG9w0…
要求编写登录接口 : 1. 输入用户名和密码 2.认证成功后显示欢迎信息 3.用户名输错,提示用户不存在,重新输入(5次错误,提示尝试次数过多,退出程序) 4.用户名正确,密码错误,提示密码错误,重新输入.(密码错误3次,锁定用户名并提示,退出程序) readme 应用知识点: 一.文件的操作 open/文件操作f=open('/tmp/hello','w')#open(路径+文件名,读写模式)#读写模式:r只读,r+读写,w新建(会覆盖原有文件),a追加,b二进制文件.常用模式如:'rb','…
product_list = [        ('Iphone',11800),        ('Mac Pro',13800),        ('BMW CAR',480000),        ('Watch',10600),        ('Coffee',31),        ('fatyao Python book',35),]shopping_list = []salary = input("Input your salary:")if salary.isdigi…
from flask import Flask, jsonify from flask import abort from flask import make_response from flask import request from flask_httpauth import HTTPBasicAuth from flask import url_for auth = HTTPBasicAuth() app = Flask(__name__) def make_public_task(ta…
上代码,redis-demo #!/usr/bin/env python #_*_ coding:UTF-8 _*_ import redis ####配置参数 host = '192.168.0.12' port = 16000 password = 'wrfg6OTNaXTqd96H7TK7bYIV' #### #连接redis #单个值的 def redis_conn(host,port,password,db,key,act="get",value=''): r = redis…
简介Thrift最初由Facebook研发,主要用于各个服务之间的RPC通信,支持跨语言,常用的语言比如C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, and OCaml都支持.Thrift是一个典型的CS(客户端/服务端)结构,客户端和服务端可以使用不同的语言开发.既然客户端和服务端能使用不同的语言开发,那么一定就要有一种中间语言来关联客户端和服务端的…
1.匹配大小写和数字,并且大小写数字均要有,且字符串长度为6~20位 ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{6,20}$ import repattern = re.compile("^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{6,20}$")flag = pattern.match("abcDEF123")if flag: print "String matches t…
# -*- coding: utf-8 -*- import unittest class MyUT(unittest.TestCase): def test_1(self): print("test-1") def test_2(selfs): print("test-2") @classmethod def run_suite(cls): suite = unittest.TestSuite() suite if __name__ == '__main__':…