Fork me on GitHub

青禹小生

雁驰万里却作禽,鱼未得水空有鳞。 花开花落花不语,昨是昨非昨亦今。

导航

03 2017 档案

获取指定日期的上一个月日期
摘要:输入:20170320,输出:20170220 阅读全文

posted @ 2017-03-30 18:30 司徒道 阅读(1498) 评论(0) 推荐(0)

爬取代理IP,并判断是否可用。
摘要:1 # -*- coding:utf-8 -*- 2 from gevent import monkey 3 monkey.patch_all() 4 5 import urllib2 6 from gevent.pool import Pool 7 8 import requests 9 import re 10 11 class SpiderProxy: 12 ... 阅读全文

posted @ 2017-03-26 13:49 司徒道 阅读(291) 评论(0) 推荐(0)

递归实现 十进制转换其他进制(2-16)
摘要:1 def to_str(n, base): 2 convert_string = "0123456789ABCDEF" 3 if n < base: 4 return convert_string[n] 5 else: 6 return to_str(n / base, base) + convert_string[n % base] 7... 阅读全文

posted @ 2017-03-14 19:49 司徒道 阅读(209) 评论(0) 推荐(0)

特殊回文数
摘要:形似1223221,12521均为回文数,给一个正整数你, 求所有这样的五位和六位的十进制数,满足个位数字之和等于n(5<=n<=54)。 阅读全文

posted @ 2017-03-11 20:20 司徒道 阅读(223) 评论(0) 推荐(0)

python 实现无序列表
摘要:1 # -*- coding:utf-8 -*- 2 class Node: 3 def __init__(self, initdata): 4 self.data = initdata 5 self.next = None 6 7 def getData(self): 8 return self.... 阅读全文

posted @ 2017-03-09 17:28 司徒道 阅读(746) 评论(0) 推荐(0)

python 实现剪刀石头布(三局两胜)
摘要:1 # -*- coding:utf-8 -*- 2 import random 3 4 # best of three 5 def finger_guess(): 6 rule = {1:'rock', 2:'paper', 3:'scissor'} 7 win_way = [['rock', 'scissor'], ['paper', 'rock'], ['s... 阅读全文

posted @ 2017-03-09 16:40 司徒道 阅读(2195) 评论(0) 推荐(0)

python 实现简单语音聊天机器人
摘要:'''思路:使用百度的文本转音频API,将结果保存成mp3格式,并用mp3play库播放该文件。''' 1 # -*- coding:utf-8 -*- 2 import sys 3 import requests 4 import json 5 import mp3play 6 import time 7 8 def talk(info): 9 appkey = "e... 阅读全文

posted @ 2017-03-09 16:39 司徒道 阅读(2997) 评论(0) 推荐(0)