摘要: 题意: You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 阅读全文
posted @ 2016-08-06 16:49 Attenton 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 题意: Write a function that takes a string as input and returns the string reversed. Example:Given s = "hello", return "olleh". 实现字符串的反转。 刚开始时,我是直接strin 阅读全文
posted @ 2016-07-30 23:08 Attenton 阅读(150) 评论(0) 推荐(0) 编辑
摘要: leetcode的第一题,two sum: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that ea 阅读全文
posted @ 2016-07-19 00:31 Attenton 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 在学习爬虫的过程了解到了在访问服务器时,有两种请求的方式,Post方式和Get方式 Post方式:向指定的资源提交要被处理的数据 Get方式:从指定的资源请求数据。 GET 方法 请注意,查询字符串(名称/值对)是在 GET 请求的 URL 中发送的: 有关 GET 请求的其他一些注释: GET 请 阅读全文
posted @ 2016-07-16 17:42 Attenton 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 此次教程使用的python版本为2.7!!! 在刚上大学之时,总是在网上看到什么爬虫,因为当时还在学习c++,没有时机学习python,更没有去学习爬虫了,而趁着这次工程实训学习了基本的python的使用,于是有提起了学习爬虫的兴致,也写下了这个系列的博客,以记录自己的积累 下面进入正题: 爬虫是什 阅读全文
posted @ 2016-07-08 13:59 Attenton 阅读(325) 评论(0) 推荐(0) 编辑
摘要: 新手在coding时经常不了解一些技巧,从而代码会很长,很复杂,下面就将介绍几个新手应该知道的几个小技巧来简化代码。 1.反转字符串 2.转置矩阵 3.将列表数据重新分别存储在单独的变量中 4.将字符串列表合并为单独的一个新的字符串 5.一行代码swap两个变量 6.不用循环打印 “codecode 阅读全文
posted @ 2016-07-05 18:31 Attenton 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 正则表达式(regular expression)描述了一种字符串匹配的模式,可以用来检查一个串是否含有某种子串、将匹配的子串做替换或者从某个串中取出符合某个条件的子串等。 python中的正则包含在一个名为re的模块中,也就是在用到正则表达式之前,都要先import re 参考博客:http:// 阅读全文
posted @ 2016-07-05 17:58 Attenton 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 1.下载安装 首先需要下载python 下载地址: https://www.python.org/downloads/ 有两个版本的python,一个是python2.7另一个是python3.5,至于下载哪一个版本则是基于学习的教程用到了那一个,那么就使用那一个 之后就是进行安装,安装路径可以自己 阅读全文
posted @ 2016-07-05 10:48 Attenton 阅读(174) 评论(0) 推荐(0) 编辑
摘要: Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example:Given a = 1 and b = 2, return 3. 利用位运算, 这里用到了一 阅读全文
posted @ 2016-06-30 19:28 Attenton 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 题意: Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were in 阅读全文
posted @ 2016-06-30 18:37 Attenton 阅读(98) 评论(0) 推荐(0) 编辑