上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 29 下一页
摘要: 1 #!/usr/bin/python 2 3 from multiprocessing import Process,Queue 4 import time 5 6 l=[] 7 q=Queue() 8 9 def f(name): 10 time.sleep(1) 11 q.put("hello"+str(name)) 12 13 for i in... 阅读全文
posted @ 2017-07-17 16:09 橙云生 阅读(245) 评论(1) 推荐(0) 编辑
摘要: 1 #!/usr/bin/python 2 3 import os,time 4 from signal import * 5 6 def get_sig(signum,stack): 7 if signum==SIGINT: 8 print "keep..." 9 elif signum==SIGALRM: 10 prin... 阅读全文
posted @ 2017-07-17 16:08 橙云生 阅读(139) 评论(1) 推荐(0) 编辑
摘要: 1 #!/usr/bin/python 2 #coding=utf-8 3 import sys,os 4 from time import sleep 5 6 (r,w)=os.pipe() #创建无名管道,返回两个整数,代表两个管道文件,且代表的功能是(r,w) 7 pid=os.fork() 8 9 if pid<0: 10 print "fail to ... 阅读全文
posted @ 2017-07-17 16:08 橙云生 阅读(367) 评论(1) 推荐(0) 编辑
摘要: 1 #!/usr/bin/python 2 #coding=utf-8 3 import multiprocessing 4 5 str= "欢迎来到菜鸟购物系统!" 6 print str.center(80) 7 money=input("请输入您的预算:",) 8 def show(): 9 print '''本商城提供以下商品: 10 ... 阅读全文
posted @ 2017-07-17 16:07 橙云生 阅读(196) 评论(1) 推荐(0) 编辑
摘要: 1 #!/usr/bin/python 2 import multiprocessing,time 3 4 class ClockProcess(multiprocessing.Process): 5 def __init__(self,value): 6 super(ClockProcess,self).__init__() 7 sel... 阅读全文
posted @ 2017-07-17 16:06 橙云生 阅读(922) 评论(1) 推荐(0) 编辑
摘要: 1 #!/usr/bin/python 2 #coding=utf-8 3 #哈夫曼树创建 4 5 class Node(): 6 def __init__(self,value,left=None,right=None): 7 self.value=value 8 self.left=left 9 self.righ... 阅读全文
posted @ 2017-07-17 16:03 橙云生 阅读(702) 评论(0) 推荐(0) 编辑
摘要: 1 #!/usr/bin/python 2 #coding=utf-8 3 class Node(): 4 def __init__(self,value,p=None): 5 self.value=value 6 self.pre=p 7 self.next=p 8 9 class linklist(): 10 ... 阅读全文
posted @ 2017-07-17 16:02 橙云生 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 1 #!/usr/bin/python 2 3 class Node(object): 4 def __init__(self,value,next=None): 5 self.value,self.next=value,next 6 7 class Linklist(object): 8 def __init__(self)... 阅读全文
posted @ 2017-07-17 16:01 橙云生 阅读(498) 评论(0) 推荐(0) 编辑
摘要: 1 #!/usr/bin/python 2 3 class TreeNode(object): 4 def __init__(self,data = 0,left = None,right = None): 5 self.data = data 6 self.left = left 7 self.right = right... 阅读全文
posted @ 2017-07-17 16:00 橙云生 阅读(2726) 评论(0) 推荐(0) 编辑
摘要: 1 #!/usr/bin/python 2 #排序方法 3 #冒泡排序 4 def buble(l): 5 for i in range(len(l)): 6 for j in range(len(l)-i-1): 7 if l[j]>l[j+1]: 8 l[j+1],l[j]=l[j],l... 阅读全文
posted @ 2017-07-17 15:59 橙云生 阅读(419) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 29 下一页