摘要: http://www.kuqin.com/docs/awk.html 阅读全文
posted @ 2016-08-16 14:52 Mr_DaLiN 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 实现组合算法C(n,k),可以用递归实现: python代码: 实现排列算法A(n,k),用递归实现: k=len(lst)s时,为全排列 阅读全文
posted @ 2016-05-08 22:14 Mr_DaLiN 阅读(8910) 评论(0) 推荐(0) 编辑
摘要: 1. 打开http://www.renren.com,审查页面元素 发现有这么一行<form method="post" id="loginForm" class="login-form" action="http://www.renren.com/PLogin.do"> 登录以post方式,地址为 阅读全文
posted @ 2016-03-26 00:29 Mr_DaLiN 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 将SQLite作为一个模块导入,模块名为sqlite3 创建一个到数据库文件的连接,如果文件不存在就会自动生成 获得连接的游标,游标可用于执行SQL查询 每次修改数据库后都要进行提交 关闭数据库 下面是具体的应用实例: 阅读全文
posted @ 2016-03-17 19:19 Mr_DaLiN 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 直接插入排序的基本操作是将一个记录插入到已经排好的有序表中。 先选定一个位置i,插入排序将i左侧比位置i数值大的数值全部右移,然后将原来i对应的值插入回去。 1 void InsertSort(int *p) 2 { 3 int i,j; 4 int tmp=0; 5 for(i=1;i<10;i+ 阅读全文
posted @ 2016-03-09 15:23 Mr_DaLiN 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 冒泡排序算法的思想是不断的交换,通过交换完成最终的排序。 选择排序的基本思想是每一趟在n-i+1个记录中选取最小的记录,作为第i个的记录。 1 void SimpleSelectSort(int *p) 2 { 3 int i,j,min; 4 for(i=0;i<10;i++) 5 { 6 min 阅读全文
posted @ 2016-03-09 14:27 Mr_DaLiN 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 冒泡排序是一种交换排序,基本思想是:相邻两两比较,若反序则交换。 定义交换操作函数: 1 void swap(int *p, int i, int j) 2 { 3 int temp = p[i]; 4 p[i] = p[j]; 5 p[j] = temp; 6 } 基本排序算法: 思想:i=0时, 阅读全文
posted @ 2016-03-09 13:02 Mr_DaLiN 阅读(264) 评论(0) 推荐(0) 编辑
摘要: Python的函数参数传递:传值?引用? 转自:http://winterttr.me/2015/10/24/python-passing-arguments-as-value-or-reference/ 阅读全文
posted @ 2016-03-08 16:51 Mr_DaLiN 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Linux的scp命令可以实现两个主机之间的文件拷贝功能。 用python实现scp功能。 def run_scp(from1, to, passwd, log_file): cmd = "scp %s %s" % (from1, to) p = pexpect.spawn(cmd) if log_ 阅读全文
posted @ 2016-03-08 15:32 Mr_DaLiN 阅读(373) 评论(0) 推荐(0) 编辑
摘要: 1 def ssh_login(ip, user="root", passwd=None, prompt="]#", port="22", log_file=None, raise_exception=True): 2 """ 3 Login remote host with ssh 4 retur 阅读全文
posted @ 2016-03-07 15:22 Mr_DaLiN 阅读(473) 评论(0) 推荐(0) 编辑