原创 再見Follow5

老朽2007年6月開始使用微博,至今已有4個年頭了,第一次使用的微博是飯否,阮老師給推薦的,當時在研發團隊要做一個類似於隨時記的網站,不過那時的隨時記和現在的隨時記差別很大,剛進入研發團隊自己什麼都不會,還處於學習階段的時候,老師給我介紹

原创 Project Euler第二題

題目: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2,

原创 使用python遠程登錄

最近要使用python做一個在web上管理交換機的程序,需要遠程登錄,就查了點資料,由於還沒有搞到交換機,就先用自己的機器測試一下。 首先python的標準庫中包含telnet,用起來也很方便,查看一下文檔寫了個小程序: #!/usr/

原创 project Euler第十題

題目: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. 算法: #!/u

原创 project Euler第三題

題目: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? 算

原创 pysnmp學習(一)

安裝pysnmp: 編譯安裝的話,pysnmp需要用到asn.1,安裝pysnmp的話需要先安裝asn.1,不過我沒有安裝成功。 也可以使用easy_install pysnmp安裝,不過我也沒用安裝成功,用的是mac,總是提示找不到

原创 project Euler第九題

題目: A Pythagorean triplet is a set of three natural numbers, a  b  c, for which, a2 + b2 = c2 For example, 32 + 42 

原创 project Euler第八題

題目: Find the greatest product of five consecutive digits in the 1000-digit number. 73167176531330624919225119674426574

原创 project Euler第六題

題目: The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square of the sum of the

原创 python中的迭代器與生成器

迭代器就是重複地做一些事情,可以簡單的理解爲循環,在python中實現了__iter__方法的對象是可迭代的,實現了next()方法的對象是迭代器,這樣說起來有點拗口,實際上要想讓一個迭代器工作,至少要實現__iter__方法和next方

原创 project Euler第七題

上大學的時候買了個手機,上邊的遊戲都是java做的,所以在還不知道什麼是java的時候就想學習java了,但是現在都研一了,還沒有怎麼學習過java,書倒是看了不少,編程思想都看兩邊了,可是從沒用java做過程序,先是用php做網站,再是

原创 project Euler第四題

題目: A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers

原创 project Euler第五題

題目: 2520is the smallest number that can be divided by each of the numbersfrom 1 to 10 without any remainder. What is

原创 project euler第一題

今天在網上剛看到的這個網站,很感興趣,想一直做下去,儘量把裏邊的題都做了。 第一道題是用python做的,剛學python,裏邊的好多東西還不是太清楚,也是第一次做這個題,可能如不了大神的法眼,我會一直努力的。 題目: If we l

原创 @修飾符--python中的裝飾器

裝飾器模式可以在不影響其他對象的情況下,以動態、透明的方式給單個對象添加職責,也能夠處理那些可以撤銷的職責。經常用於日誌記錄、性能測試等場合。 想象一下這個很常見的場景,你寫了一個方法只提供給以登陸的用戶訪問(事實上我也是通過django