是个传颂厨

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
上一页 1 ··· 4 5 6 7 8

2016年3月9日

摘要: 从第一个数字开始,一个个进行比较,如果小于前者,交换位置。 然后是第二个。 阅读全文
posted @ 2016-03-09 22:04 是个传颂厨 阅读(133) 评论(0) 推荐(0) 编辑

摘要: # -*- coding: UTF-8 -*- def bubble_sort(a): for i in range(len(a)-1): j = 0 while(j<len(a)-i-1): if a[j]>a[j+1]: a[j],a[j+1]=a[j+1],a[j]#交换数值 j+=1 els 阅读全文
posted @ 2016-03-09 20:04 是个传颂厨 阅读(107) 评论(0) 推荐(0) 编辑

2016年3月4日

摘要: # -*- coding: UTF-8 -*- from numpy import* a = arange(3*3).reshape(3,3) b = arange(3*3).reshape(3,3) c = hstack((a,b))#水平组合 d = vstack((a,b))#垂直组合 #hs 阅读全文
posted @ 2016-03-04 15:03 是个传颂厨 阅读(131) 评论(0) 推荐(0) 编辑

摘要: # -*- coding: UTF-8 -*- from numpy import* a = arange(6)#创建一维数组 for i in range(0,6): a[i]=0 print a b = arange(5*5).reshape(5,5)#创建二维数组 for i in range 阅读全文
posted @ 2016-03-04 14:27 是个传颂厨 阅读(123) 评论(0) 推荐(0) 编辑

摘要: s = raw_input(">>>") x,y = s.split(" ") print x,y 可让我好好折腾了一番,本来打算一个个输入,然后用这个可以实现间隔输入,上面这个就是空格隔开的输入。 阅读全文
posted @ 2016-03-04 09:00 是个传颂厨 阅读(61) 评论(0) 推荐(0) 编辑

2016年3月2日

摘要: # -*- coding: utf-8 -*-#输入中文要用 class Queue(): def __init__(qu,size):#类比栈 qu.queue=[]; qu.size=size; qu.head=0; qu.tail=0; def Empty(qu): if qu.head==q 阅读全文
posted @ 2016-03-02 17:13 是个传颂厨 阅读(103) 评论(0) 推荐(0) 编辑

摘要: # -*- coding: utf-8 -*-#输入中文要用 class Stack(): def __init__(st,size):#创建一个栈,用列表 st.stack=[]; st.size=size; st.top=0; def push(st,content):#入栈操作 if st.F 阅读全文
posted @ 2016-03-02 16:32 是个传颂厨 阅读(127) 评论(0) 推荐(0) 编辑

2016年3月1日

摘要: 为了持久储存对象,将对象序列化,使用的时候将其恢复。 # -*- coding: utf-8 -*- import pickle a = ["1", "2", "3", "3"] b = pickle.dumps(a)#将对象序列化 print b c = pickle.loads(b) print 阅读全文
posted @ 2016-03-01 12:39 是个传颂厨 阅读(90) 评论(0) 推荐(0) 编辑

上一页 1 ··· 4 5 6 7 8