Technology Learning

导航

08 2013 档案

python 核心编程课后练习(chapter 6)
摘要:6-1 1 #6-1 2 3 #help(string) 4 import string 5 6 str = "helloworld" 7 substr = "h1e" 8 9 if string.find(str, substr) != -1:10 print"substr=%s is part of %s" % (substr, str)11 else:12 print"not substring" View Code 6-2 1 #6-2 2 import string 3 import keyword 4 阅读全文

posted @ 2013-08-15 19:26 浔阳渔夫 阅读(436) 评论(0) 推荐(0)

python 核心编程课后练习(chapter 5)
摘要:5-21 #5-22 def mul(x, y):3 return x * y4 5 print mul(4,5) View Code 5-3 1 #5-3 2 def value_score(num): 3 if 90 a[j]:20 a[i], a[j] = a[j], a[i]21 22 print"New arrary:"23 show_all(a) View Code 阅读全文

posted @ 2013-08-05 19:48 浔阳渔夫 阅读(313) 评论(0) 推荐(0)

python 核心编程课后练习(chapter 3)
摘要:3-8 1 #3-8 2 "makeTextFile.py -- create text file" 3 4 import os 5 ls = os.linesep 6 7 #get filename 8 fname = raw_input() 9 while True:10 11 if os.path.exists(fname):12 print "ERROR: '%s' already exists" % fname13 else:14 break15 all = []16 print "\nEnter lines ( 阅读全文

posted @ 2013-08-02 09:58 浔阳渔夫