python challenge心得
来源:互联网 发布:java的发展和前景如何 编辑:程序博客网 时间:2024/05/23 05:06
0.
pow(2,38)
或者2**38
1.
def f(str): l=[] for x in str: if 'a'<=x<='z' or 'A'<=x<='Z': x=chr((ord(x)+2-ord('a'))%26+ord('a')) l.append(x) return ''.join(l)s="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."print f('map')
2.
def f(file): l=[] f=open(file,'r') w=f.read() for i in w: if 'a'<=i<='z' or 'A'<=i<='Z': l.append(i) return ''.join(l)print f('y.txt')
3.
import urllib2,ref=urllib2.urlopen('http://www.pythonchallenge.com/pc/def/equality.html')ans=''data=f.read()pattern = '[a-z][A-Z]{3}([a-z])[A-Z]{3}[a-z]'print ''.join(re.findall(pattern,data))
得到linkedlist
4.
import urllib2,rer=re.compile(r'(\d+)$')result='12345'while (1): try: f=urllib2.urlopen("http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=%s"%result) data=f.read() print data f.close() old=result result=r.search(data).group() except: result=old
5.
pickle 序列化与反序列化 将数据反序列化(loads())为list
import picklef=open('5.txt')text=f.read()obj=pickle.loads(text)for list in obj: print ''.join(t[0]*t[1] for t in list)f.close()
0 0
- python challenge心得
- python challenge 过关心得 逐步更新
- python challenge
- Python Challenge
- Python Challenge
- python challenge
- Python Challenge
- Python challenge
- python challenge
- Python Challenge
- Lua Challenge -- From Python Challenge
- Python Challenge 谜题0
- Python Challenge 谜题1
- Python Challenge 谜题2
- Python Challenge 谜题3
- Python Challenge 谜题4
- python challenge 4-6
- python challenge 7-9
- Runtime 运行时:知识点
- Spark性能优化指南——高级篇
- 把写好的Java类导出jar,在另外的项目引用
- ACM--圆的摆线公式--湘大oj 1088--Cycloid
- JavaScript对象
- python challenge心得
- 音视频编解码技术零基础学习方法
- 解决MyEclipse10启动时Could not create the view: An unexpected exception was thrown.
- mysql的MERGE存储引擎
- ReentrantLock解析,lock与unlock方法分析
- Java学习之构造方法
- 括号配对问题
- 虚拟机无法打开内核设备:\\Global\\vmx86
- ToggleButton控件