《笨方法学Python》
威胁狩猎与分析
威胁狩猎与分析
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
习题1--第一个程序
一:代码 print "Hello World!" print "Hello Again" print "I like typing this." print "This is fun." print "Yay! Printing." print "I'd much rather you 'not'." print 'I "said" do not touch this.' 二:附加练习原创 2016-09-24 00:25:38 · 610 阅读 · 0 评论 -
习题15--读取文件
这个习题涉及写两个文件:一个是正常的ex15.py文件,另外一个是ex15_sample.txt下面是该文本内容: This is stuff I typed into a file. It is really cool stuff. Lots and lots of fun to have in here. 一:代码 from sys import argv script, file原创 2016-10-17 00:58:24 · 3112 阅读 · 0 评论 -
习题14--提示和传递
一:代码 from sys import argv script, user_name = argv prompt = '> ' print "Hi %s, I'm the %s script." % (user_name, script) print "I'd like to ask you a few questions." print "Do you like me %s?" % us原创 2016-10-16 23:02:44 · 527 阅读 · 0 评论 -
习题11--提问
一:代码 print "How old are you?", age = raw_input() print "How tall are you??", height = raw_input() print "How much do you weigh?", weight = raw_input() print "So, you're %r old, %r tall and %r heavy.原创 2016-09-28 23:25:10 · 478 阅读 · 0 评论 -
习题10--转义字符
一:代码 # _*_ coding:utf-8 _*_ tabby_cat = "\tI'm tabbed in." # \t水平制表符 persian_cat = "I'm split\non a line." # \n 换行符 backslash_cat = "I'm \\ a \\ cat." fat_cat = """ I'll do a list: \t* Cat food \t*原创 2016-09-26 22:55:28 · 2293 阅读 · 0 评论 -
习题9--打印,打印,打印
一:代码 # Here's some new strange stuff, remember type it exactly. days = "Mon Tue Wed Thu Fri Sat Sun" months = "Jan\nFed\nMar\nApr\nMay\nJun\nJul\nAug" print "Here are the days: ",days print "Here a原创 2016-09-26 22:51:00 · 382 阅读 · 0 评论 -
习题8--打印,打印
一:代码 formatter = "%r %r %r %r" print formatter % (1, 2, 3, 4) print formatter % ("one", "two", "three", "four") print formatter % (True, False, False, True) print formatter % (formatter, formatter,原创 2016-09-26 22:48:30 · 414 阅读 · 0 评论 -
习题13--参数、解包和变量
一:代码 from sys import argv script, first, second, third = argv print "The script is called:", script print "Your first variable is:", first print "Your second variable is:", second print "Your third原创 2016-10-11 23:54:02 · 1806 阅读 · 0 评论 -
习题7--更多打印
一:代码 print "Mary had a little lamb." print "Its fleece was white as %s." % 'snow' print "And everywhere that Mary went." print "." * 10 # what'd that do? end1 = "C" end2 = "h" end3 = "e" end4 = "e"原创 2016-09-25 20:37:18 · 513 阅读 · 0 评论 -
习题6--字符串和文本
一:代码 x = "There are %d types of people." % 10 binary = "binary" do_not = "don't" y = "Those who know %s and those who %s" % (binary, do_not) print x print y print "I said: %r." % x print "I also sa原创 2016-09-24 23:36:04 · 1053 阅读 · 0 评论 -
习题5--更多的变量和打印
一:代码 my_name = 'Zed A. Shaw' 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 %s." % my_name print "原创 2016-09-24 00:53:03 · 795 阅读 · 0 评论 -
习题4--变量和命名
一:代码 cars = 100 space_in_a_car = 4.0 drivers = 30 passengers = 90 cars_not_driven = cars - drivers cars_driven = drivers carpool_capacity = cars_driven * space_in_a_car average_passengers_per_car = p原创 2016-09-24 00:38:35 · 490 阅读 · 0 评论 -
习题3--数字与数学计算
一:代码 print "I will now count my chickens:" print "Hens", 25 + 30 / 6 print "Rooters", 100 - 25 * 3 % 4 print "Now I will count the eggs:" print 3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 + 6 print "Is it true原创 2016-09-24 00:35:20 · 970 阅读 · 1 评论 -
习题2--注释和#符号
一:代码: # A comment, this is so you can read your program later. # Anything after the # is ignored by python. print "I could have code like this." # and the comment after is ignored # You can also us原创 2016-09-24 00:29:10 · 542 阅读 · 0 评论 -
习题12--raw_input()提示别人
对于raw_input()而言,你可以让它显示出一个提示,从而告诉别人应该输入什么。 一:代码 age = raw_input("How old are you? ") height = raw_input("How tall are you? ") weight = raw_input("How much do you weight? ") print "So, you're %r old原创 2016-10-08 07:53:28 · 2418 阅读 · 1 评论
分享