- Java有Quartz這個強大的排程套件,Python當然也有=>Advanced Python Scheduler (APScheduler)
- 簡單的http client (Python3以前是httplib)
''' Created on 2011/11/10 這個程式可以簡單的測試網頁伺服器是否運作正常 @author: Joseph ''' import http.client conn = http.client.HTTPConnection("www.google.com.tw") conn.request('GET', '/') r1 = conn.getresponse() print(r1.status, r1.reason) #正常的話會印出 200 OK conn.close()
3. 加密 hash
''' Created on 2011/11/10 @author: Joseph ''' import hashlib md5 = hashlib.md5() #官網 Note : Feeding string objects is to update() is not supported, as hashes work on bytes, not on characters. md5.update(b"This is a book")#因為上述,所以字串前多加一個b print(md5.digest()) #加密後用二進位表示 print(md5.hexdigest()) #加密後用十六進位表示 #第7,9,11合在一起成下列寫法 print(hashlib.new("md5", b"This is a book").hexdigest())
沒有留言:
張貼留言