摘要:
View Code 1 #-*- coding:utf8-*- 2 import time 3 start = time.time() 4 5 from urllib2 import Request,urlopen 6 from urllib import quote_plus 7 info='the flowers are on their way' 8 url='http://www.pythonchallenge.com/pc/stuff/violin.php' 9 req = Request(url, headers={'Cookie': 阅读全文
摘要:
View Code 1 #-*- coding:utf8-*- 2 import time 3 start = time.time() 4 ''' 5 import xmlrpclib 6 7 server = xmlrpclib.ServerProxy("http://localhost:80") 8 9 words = server.sayHello()10 11 print "result:" + words12 '''13 import xmlrpclib14 server = xmlrpclib. 阅读全文
摘要:
View Code 1 #-*- coding:utf8-*- 2 import time 3 start = time.time() 4 ''' 5 import xmlrpclib 6 7 server = xmlrpclib.ServerProxy("http://localhost:80") 8 9 words = server.sayHello()10 11 print "result:" + words12 '''13 import xmlrpclib14 server = xmlrpclib. 阅读全文
摘要:
View Code 1 #-*- coding:utf8-*- 2 import time 3 start = time.time() 4 ''' 5 import xmlrpclib 6 7 server = xmlrpclib.ServerProxy("http://localhost:80") 8 9 words = server.sayHello()10 11 print "result:" + words12 '''13 import xmlrpclib14 server = xmlrpclib. 阅读全文
摘要:
View Code 1 #-*- coding:utf8-*- 2 import time 3 start = time.time() 4 5 # Get the data from: http://www.pythonchallenge.com/pc/return/evil2.gfx 6 7 h = open("evil2.gfx", "rb") 8 data = h.read() 9 h.close()10 11 new_data = [[], [], [], [], []]12 n = 013 14 for byte in range(len(da 阅读全文
摘要:
View Code 1 #-*- coding:utf8-*- 2 import time 3 start = time.time() 4 5 import Image 6 7 # download the image from: http://www.pythonchallenge.com/pc/return/cave.jpg 8 9 image = Image.open("cave.jpg")10 nsize = tuple([x / 2 for x in image.size])11 odd = even = Image.new(image.mode, nsize)1 阅读全文
摘要:
1 #-*- coding:utf8-*- 2 import time 3 import re 4 start = time.time() 5 ''' 6 a = [1, 11, 21, 1211, 111221, 7 len(a[30]) = ? 8 ''' 9 10 def find_L(st):11 nums = re.findall(r'1+|2+|3+|',st)12 strs = ''13 for i in nums:14 if len(i):15 strs += str(len(i)) + i[0]1 阅读全文
摘要:
1 #-*- coding:utf8-*- 2 import time 3 import re 4 import Image 5 import ImageDraw 6 start = time.time() 7 8 fo = open("10","r+") 9 nums = fo.read()10 num = ''11 for i in nums:12 if i != '\n':13 num += i14 nums = []15 for n in re.findall(r'\d+',num):16 nums 阅读全文
摘要:
#-*- coding:utf8-*-import timestart = time.time()#un: 'BZh91AY&SYA\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x02\x00 \x00!\x9ah3M\x07<]\xc9\x14\xe1BA\x06\xbe\x084'#pw: 'BZh91AY&SY\x94$|\x0e\x00\x00\x00\x81\x00\x03$ \x00!\x9ah3M\x13<]\xc9\x14\xe1BBP\x91\xf08''''b 阅读全文
摘要:
1 #-*- coding:utf8-*- 2 import time 3 import Image 4 start = time.time() 5 #先将图片 oxygen.png 下载 6 import re, Image 7 8 i = Image.open("oxygen.png") # http://www.pythonchallenge.com/pc/def/oxygen.png 9 row = [i.getpixel((x, 45)) for x in range(0, i.size[0], 7)]10 print row11 ords = [r for r, 阅读全文
摘要:
1 #-*- coding:utf8-*- 2 import time 3 import zipfile 4 import re 5 start = time.time() 6 ''' 7 学习 zipfile http://blog.csdn.net/jgood/article/details/4351911 8 ''' 9 '''10 welcome to my zipped list.11 12 hint1: start from 9005213 hint2: answer is inside the zip14 & 阅读全文
摘要:
1 ''' 2 将banner.p下载 放在与程序同一文件夹下 3 ''' 4 fo = open("banner.p","r+") 5 #strs = pickle.dumps(fo.read()) 6 st = pickle.load(fo) 7 #print strs 8 for line in st: 9 print "".join([k*v for k,v in line])10 # channel 阅读全文
摘要:
import restart = time.time()pattern = "and the next nothing is (\d+)"re_url = "http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing="nothing = "6711"url = urlopen(re_url + nothing)strs = url.read()obj = re.search(pattern,strs)while obj: nothing = obj.group(1) ur 阅读全文
摘要:
1 import re2 fo = open("4","r+")3 strs = fo.read()4 #print strs5 s = ''6 for res in re.findall(r'[a-z][A-Z]{3}([a-z])[A-Z]{3}[a-z]',strs):7 s += res8 print s 9 #xXXXxXXXx 阅读全文
摘要:
fo = open("3","r+")print fo.name,fo.modestrs = fo.read()res = ''for x in strs: obj = re.match(r'[a-z]',x) if obj: res += obj.group()print res 阅读全文
摘要:
strs = '''g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.'''def change(strs): res = [] for x in strs: if x != ' 阅读全文
摘要:
print 2**38仅此而已 十分简单! 阅读全文
摘要:
这是来到这里的第一篇文章 为了纪念 也为了开始!纪念我的红尘 开始我的一叶一花! 阅读全文