摘要: 1 def break_words(stuff): 2 """This is function will break up words for us.""" 3 words = stuff.split(' ') 4 return words 5 6 def sort_words(words): 7 """sort the words.""" 8 ... 阅读全文
posted @ 2016-11-23 00:10 听风呤 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 1 # -*- coding:utf-8 -*- 2 print ("Let's practice everything.") 3 print ('You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs.') 4 5 '''poem = """ 6 \tThe lovely world ... 阅读全文
posted @ 2016-11-21 11:33 听风呤 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 1 之前遇到过的符号汇总 2 常用的powershell命令 3 pwd(打印当前工作目录) 4 hostname(电脑在网络中的名称) 5 mkdir(创建路径/目录/文件夹) 6 cd (加载路径) 7 ls(列出路径下的内容) 8 rmdir(删除路径/目录) 9 pushd (推送路径) 10 popd(弹出路径) 11 cp (复制文件或目录) 12 robocopy... 阅读全文
posted @ 2016-11-21 11:33 听风呤 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 1 # -*-coding:utf-8 -*- 2 def add(a, b): 3 print ("ADDING %d + %d" % (a, b)) 4 return a + b #要理解return的功能 5 6 def subtract(a, b): 7 print ("SUBSTRACTING %d - %d" % (a, b)) 8 ... 阅读全文
posted @ 2016-11-21 11:32 听风呤 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 1 # -*- coding: utf-8 -*- 2 from sys import argv 3 4 script, input_file = argv 5 6 def print_all(f): 7 print (f.read()) 8 9 def rewind(f): 10 f.seek(0) 11 #seek那个函数不返回值,你pri... 阅读全文
posted @ 2016-11-20 12:05 听风呤 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 1 # -*- coding:utf-8 -*- 2 def cheese_and_crackers(cheese_count, boxes_of_crackers): 3 print ("You Have %d cheeses!" % cheese_count) 4 print ("You have %s boxes of crackers!" % boxes_of... 阅读全文
posted @ 2016-11-20 00:44 听风呤 阅读(413) 评论(0) 推荐(0) 编辑
摘要: 1 # this one is like your scripts with argv 2 def print_two(*args): #函数命名规则和变量名一样,只能以字母、数字和下划线组成,数字不可以作为开头 3 arg1, arg2 = args 4 print ("arg1: %r, arg2: %r" % (arg1,arg2)) # 不要混淆TAB键... 阅读全文
posted @ 2016-11-20 00:41 听风呤 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 1 # -*- coding:utf-8 -*- 2 from sys import argv 3 from os.path import exists 4 5 script, from_file, to_file = argv 6 7 print ("copying from %s to %s" % (from_file, to_file)) 8 9 # we cou... 阅读全文
posted @ 2016-11-19 00:50 听风呤 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 1 # -*- coding:utf-8 -*- 2 3 from sys import argv 4 5 script, filename = argv #解包变量参数 6 7 print ("we're going to erase %r." % filename) 8 print ("if you don't want that, hit CTRL-C(^c).... 阅读全文
posted @ 2016-11-19 00:48 听风呤 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 1 # -*-coding:utf-8 -*- 2 from sys import argv 3 4 script, filename =argv #参数赋值 5 6 txt = open(filename) #txt变量为打开文件 7 8 print ("Here's your file %r:" % filename) #在屏幕上提示您的文件名 9 print (... 阅读全文
posted @ 2016-11-17 11:58 听风呤 阅读(160) 评论(0) 推荐(0) 编辑