11 2015 档案

python异常
摘要:python下异常如何处理: 1 #encoding=utf-8 2 3 """ 4 python遇到异常,程序直接运行 5 try: 6 "判断有可能抛出异常的代码" 7 print "haha" 8 except: 9 "异常下运行的代码" 10... 阅读全文

posted @ 2015-11-29 20:52 阳台 阅读(208) 评论(0) 推荐(0) 编辑

python字典
摘要:#!/usr/bin/python #encoding=utf-8dict={} dict['x'] = 1dict1 = {'x':1, 'y':2, 'z':3}print dict1#'x':1, 'y':2, 'z':3for i in dict1.keys(): print ifo... 阅读全文

posted @ 2015-11-29 20:14 阳台 阅读(245) 评论(0) 推荐(0) 编辑

汉诺塔 python版
摘要:汉诺塔问题:如果将n个盘子(由小到大)从a通过b,搬到c,搬运过程中不能出现小盘子在大盘子下面的情况。 思路分析:假设前要移动第100个盘子,分两步走,移动第99个;再移动第100个;而要移动第99个,同样分两部,移动第98个,再移动第99个,以此类推; if(n>1) { 1、先将A柱... 阅读全文

posted @ 2015-11-28 21:01 阳台 阅读(236) 评论(0) 推荐(0) 编辑

linux 使用ssh到远端并且使用while的坑
摘要:如果要使用ssh批量登录到其它系统上操作时,我们会采用循环的方式去处理,那么这里存在一个巨大坑,你必须要小心了。 现在是想用一个脚本获取远程服务器端/root下面的文件:1 #!/bin/bash2 3 cat 'ip.txt'|while read line;do4 echo... 阅读全文

posted @ 2015-11-26 18:53 阳台 阅读(453) 评论(0) 推荐(0) 编辑

python 命令行参数,以及文件操作
摘要:1 #demo.py2 #!/usr/bin/python 3 import sys4 5 print sys.argv #python demo.py 11 22 33 44 55 ['demo.py', '11', '22', '33', '55'] 可见,sys.argv是一个list,... 阅读全文

posted @ 2015-11-26 18:01 阳台 阅读(1988) 评论(0) 推荐(0) 编辑

python 内部函数,以及lambda,filter,map等内置函数
摘要:1 #!/usr/bin/python 2 #encoding=utf-8 3 4 def back(): 5 return 1,2, "xxx" 6 7 #python 可变参数 8 def test(*param): 9 print "参数的长度是:%d" % len(p... 阅读全文

posted @ 2015-11-26 17:27 阳台 阅读(369) 评论(0) 推荐(0) 编辑

编译ycm库
摘要:在安装完YCM之后,重新打开vim还会出现如下的报错信息:ycm_client_support.[so|pyd|dll] and ycm_core.[so|pyd|dll] not detected; you need to compile YCM before using it. Read the... 阅读全文

posted @ 2015-11-24 18:51 阳台 阅读(603) 评论(0) 推荐(0) 编辑

python 序列(list,tuple,str)基本操作
摘要:添加元素: mylist.append() mylist.extend([1, 2]) mylist.insert(1, "pos")删除元素: mylist.remove(value) #del语句,并非函数 del mylist[pos] #del mylist #从内存中删除... 阅读全文

posted @ 2015-11-22 20:43 阳台 阅读(421) 评论(0) 推荐(0) 编辑

python之logging模块
摘要:python的logging模块总结: 1 #!/usr/bin/python 2 #encoding=utf-8 3 4 import logging 5 6 logging.basicConfig(level=logging.DEBUG, 7 format='%(asct... 阅读全文

posted @ 2015-11-10 09:54 阳台 阅读(215) 评论(0) 推荐(0) 编辑

linux select 网络模型
摘要:io模型: 同步IO: 阻塞形式,非阻塞形式(轮询)、信号驱动IO、IO复用(select, poll, epoll); 异步io:aio_read() 典型场景: 1、客户端处理多种IO-------标准io 和网络io(套接字) 2、server端既要处理监听套接字又要处理已连接的套接字 3、一 阅读全文

posted @ 2015-11-08 21:31 阳台 阅读(366) 评论(0) 推荐(0) 编辑

python wsgi
摘要:什么是wsgi? wsgi是一个web组件的接口防范,wsgi将web组件分为三类:web服务器,web中间件,web应用程序 wsgi基本处理模式为:wsgi Server -> wsgi middleware -> wsgi applicationwsgi server: 理解为一个符合w... 阅读全文

posted @ 2015-11-05 09:56 阳台 阅读(1731) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示