摘要: 1 from sys import argv 2 3 script, frist, second, third = argv 4 5 print ("the script is called:",script) 6 print ("Your frist bus is:",frist) 7 print ("your second variable is:",second) ... 阅读全文
posted @ 2016-11-17 11:57 听风呤 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 1 # -*-coding:utf-8 -*- 2 from sys import argv 3 4 script, user_name, city = argv 5 rompt = ">>" #巧妙的提示符的运用 取一个变量名就ok了 6 7 print ("Hi %s, I'm the %s script." %(user_name, script)) 8 pr... 阅读全文
posted @ 2016-11-17 11:57 听风呤 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1 # -*-coding:utf-8 -*- 2 print ("how old are you?"),# python 3.0版本开始已经去掉了raw_input函数,直接用input函数就可以了 3 age = input("old?") 4 print ("how tall are you?"), 5 height = int(float(input())) #假如输... 阅读全文
posted @ 2016-11-16 20:09 听风呤 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 1 # -*-coding:utf-8 -*- 2 print ("how old are you?"), 3 age = input() # python 3.0版本开始已经去掉了raw_input函数,直接用input函数就可以了 4 print ("how tall are you?"), 5 height = int(float(input())) #假如输入的是小数点... 阅读全文
posted @ 2016-11-16 20:08 听风呤 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 1 ''' 2 tabby_cat = "\tI'm tabbed in." 3 persian_cat = "I'm split\non a line." 4 backslash_cat = "I'm \\ a \\ cat." 5 6 fat_cat = """ 7 I'll do a list: 8 \t* catfood 9 \t* Fishies 10 \... 阅读全文
posted @ 2016-11-16 20:07 听风呤 阅读(136) 评论(0) 推荐(0) 编辑
摘要: #-*- coding:utf-8 -*- days = "mon Tue Wed Thu Fri Sat Sun" months = "Jan\vFeb\vMar\vApr\vMay\vJul\nJul\nAug" #开始熟悉转义序列的用法 这里用到的是\n ASCII 换行符 #\v ASCII 垂直制表符 print ("here are the days: ", days) p... 阅读全文
posted @ 2016-11-15 13:36 听风呤 阅读(114) 评论(0) 推荐(0) 编辑
摘要: # -*- coding:utf-8 -*- formatter = "%s %s %s %s" #理解%s 和%r 输出时的不同 print (formatter % (1,2,3,4)) #python3.x与python2.x有一点区别,原来%(变量名,...)应该是加在print括号里 #如:print("who is the murder? %s or %s" % (a, b)... 阅读全文
posted @ 2016-11-15 13:35 听风呤 阅读(100) 评论(0) 推荐(0) 编辑
摘要: # -*- coding:utf-8 -*- print ("Mary had a little lamb.") print ("its fleece was white as %s." % 'snow') print ("And everywhere that Mary went.") print ("+" * 1000 )# what'd that do? 这句话的写法要了解 end1 ... 阅读全文
posted @ 2016-11-15 13:34 听风呤 阅读(128) 评论(0) 推荐(0) 编辑
摘要: # -*- coding:utf-8 -*- x = "there are %d type of people." % 10 #IndentationError: unexpected indent 格式没对齐 binary = "binary" do_not = "don't" y = "those who know %s and those who %s." % (binary,do_no... 阅读全文
posted @ 2016-11-14 14:35 听风呤 阅读(127) 评论(0) 推荐(0) 编辑
摘要: # -*- coding:utf-8 -*- """my_name = 'tingfengyin' my_age = 35 # not a lie my_height = 74 #inches my_weight = 180 #lbs my_eyes = 'blue' my_teeth = 'white' my_hair = 'brown' print ("let's talk about %... 阅读全文
posted @ 2016-11-14 14:34 听风呤 阅读(140) 评论(0) 推荐(0) 编辑