![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
街角祝福
这个作者很懒,什么都没留下…
展开
-
pythonchallenge--2
代码:from urllib import *src = urlopen(r'http://www.pythonchallenge.com/pc/def/ocr.html')for i in range(37): #排除前面没用的37行 text.readline()a = []str1 = text.read()for i in str1: if i.isa原创 2012-08-12 01:10:51 · 1347 阅读 · 0 评论 -
Problem 8--找连续的五个数的最大乘积
Question:import refrom operator import mula = '731671765313306249192251196744265747423553491949349698352031277450632623957831801698480186947885184385861560789112949495459501737958331952853208805原创 2012-08-15 16:50:22 · 1091 阅读 · 0 评论 -
Fibonacci sequence
#################################################################################Question: ##Each new term in the Fibonacci sequen原创 2012-08-14 15:50:05 · 801 阅读 · 0 评论 -
pythonchallenge--4
先贴代码吧。from urllib import *import reimport ossrc = urlopen(r'http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=12345')nexturl = Noneurl = r'http://www.pythonchallenge.com/pc/def/li原创 2012-08-12 15:36:27 · 1036 阅读 · 0 评论 -
pythonchallenge--5
题目:http://www.pythonchallenge.com/pc/def/peak.html看到这个题目,标题"peak hell",下面写着"pronounce it",而且网页源码提示说这个“是不是很熟悉?”,我就在着急这个标题能读出个啥东西出来,由于python学的时间短,英语也不是很好,所以问老师去了,百度了下,没搜到。郁闷,实在没办法找找答案去。所以这题是看别人做完的。原创 2012-08-12 20:57:07 · 1118 阅读 · 0 评论 -
pythonchallenge--10
a = '1'for i in xrange(30): pos = 0 tmp = '' str_len = len(a) while pos < str_len: count = 1 while pos+1<str_len and a[pos] == a[pos+1]: count += 1转载 2012-08-13 10:21:59 · 791 阅读 · 0 评论 -
pythonchallenge--9
题目链接:http://www.pythonchallenge.com/pc/return/good.htmlimport Image,ImageDrawim = Image.new('RGB', (500,500))draw = ImageDraw.Draw(im)first=[146,399,163,403,146,399,163,403,170,393,169,391,166,3翻译 2012-08-13 09:56:43 · 1414 阅读 · 0 评论 -
pythonchallenge--7
import Imageim = Image.open('oxygen.png')print ('image information:',im.format,im.size,im.mode)y_begin = 0while True: p = im.getpixel((0,y_begin)) if p[0] == p[1] == p[2]: b翻译 2012-08-13 08:56:06 · 1097 阅读 · 0 评论 -
pythonchallenge--8
题目:http://www.pythonchallenge.com/pc/def/integrity.html点击蜜蜂发现可以分登录,而网页源码中恰好有两行,像是加密了的用户名和密码,又发现字符串的前缀是bz2的,所以用bz2解压试试,结果不小心就出来了。import bz2un = 'BZh91AY&SYA\xaf\x82\r\x00\x00\x01\x01\x80\x02\xc0\x原创 2012-08-13 09:39:06 · 1547 阅读 · 0 评论 -
pythonchallenge--1
先贴代码:import stringstr = r"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原创 2012-08-12 00:12:38 · 464 阅读 · 0 评论 -
pythonchallenge--0
先贴代码吧!#!/usr/bin/env pythonimport ospreurl = r'http://www.pythonchallenge.com/pc/def/0.html'page = 2**38newurl = preurl.replace('0',str(page))os.startfile(newurl) #打开网页题目是要求用图片中结果替换掉当前网页中的原创 2012-08-11 23:46:13 · 416 阅读 · 0 评论 -
pythonchallenge--3
题:http://www.pythonchallenge.com/pc/def/equality.html好吧,看完题目我只知道一个小写字母和两边的大保镖,然后就不知道该怎么下去了,我表示我还不习惯做这种题目。后来,看了别人的解释,才知道要从网页的源文件读取,坑爹坑到家了,我根本就没没往这方面想。然后就知道是要正则表达式来查找字符串了。可是正则表达式的结果是:['qIQNlQSLi',原创 2012-08-12 13:12:49 · 1033 阅读 · 0 评论 -
project euler--10
Question:The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million.Code:import mathdef IsPrime(n): if n==1: return False else原创 2012-08-16 00:13:14 · 602 阅读 · 0 评论