摘要: 一、webbrowser模块——打开浏览器获取指定页面 open()函数 能够启动一个新浏览器 二、requests模块——从Internet上下载文件和网页 下载并保存到文件的步骤: ①调用requests.get()下载该文件 ②用'wb'调用open(),以写二进制的方式打开一个新文件 ③利用 阅读全文
posted @ 2017-05-20 21:20 回冬 阅读(386) 评论(0) 推荐(0) 编辑
摘要: 一、冒泡排序(交换排序) 二、选择排序 三、插入排序 四、希尔排序——(插入排序的改进) 五、快速排序——(冒泡排序的改进) 过程:通过一趟排序将要排序的数据分割成独立的两部分,其中一部分的所有数据都比另外一部分的所有数据都要小,然后再按此方法对这两部分数据分别进行快速排序(递归实现)。 一趟快速排 阅读全文
posted @ 2017-05-14 21:46 回冬 阅读(479) 评论(0) 推荐(0) 编辑
摘要: 题目: Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,- 阅读全文
posted @ 2017-05-08 09:57 回冬 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted i 阅读全文
posted @ 2017-04-12 10:48 回冬 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, 阅读全文
posted @ 2017-04-11 20:46 回冬 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra spac 阅读全文
posted @ 2017-04-11 19:38 回冬 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 一、测试 二、调试 1、抛出异常——针对可恢复的错误 ① try-except语句 :在调用该函数的代码中 ② raise语句—raise Exception() :在函数中 2、取得反向跟踪的字符串——调用栈 traceback模块 3、断言——针对开发,即程序员的错误 1)assert语句,包括 阅读全文
posted @ 2017-04-06 21:27 回冬 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 一直不是很理解python中'if __name__ == '__main__':' 的作用,今天查了一下各位大神的博客,总结如下: if 语句有2个作用: 1、可以在这个if下测试函数或类,这一句与c中的main()函数所表述的是一致的,即作为入口; (这种情况可以看我刚整理的一篇博客:http: 阅读全文
posted @ 2017-04-05 17:35 回冬 阅读(309) 评论(0) 推荐(0) 编辑
摘要: 题目: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would hav 阅读全文
posted @ 2017-04-05 16:54 回冬 阅读(464) 评论(0) 推荐(0) 编辑
摘要: 在硬盘上创建,读取,保存文件的基础上,如何使用Python批量复制,改名,移动或压缩文件 一、shutil 模块 1.复制文件和文件夹 shutil.copy(source, destination) 返回被复制文件的路径字符串 shutil.copytree(source, destination 阅读全文
posted @ 2017-02-21 15:15 回冬 阅读(241) 评论(0) 推荐(0) 编辑