自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 收藏
  • 关注

转载 Python Class and Object

Class简称类,Object简称对象,instance简称实例三者如何的关系是:Class最大,之后是Object,instance是Object里面的一例。例如:有一池鱼(Class),有泥鳅(Class1),泥鳅内有一条叫小丽(Object)。小丽是泥鳅的成员,泥鳅又是鱼的成员。对象属于某个类,而某个类又属于另一个类。记住:类是抽象的模板,它不是一个具体的东西,是一个用来描述具...

2017-04-23 22:20:00 257

转载 Python 列表生成式

什么叫列表生成式:Python内置的可生成list的表达式例如:要生成一个list[1-10],可以用range()>>> range(1,11)[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]有关range()解释可以百度下,以及需留意(1, 11)只会显示1-10的数字。那如果要生成(1*1, 2*2, 3*3 ... 10...

2017-04-18 22:42:00 274

转载 EX40

1 # this goes in mystuff.py2 def apple():3 print "I AM APPLES!"4 5 # this is just a variable6 tangerine = "Living reflection of a dream." # 以上资料保存为mystuff.py1 import mystuff...

2017-02-19 17:34:00 159

转载 EX39

1 # create a mapping of state to abbreviation 2 states = { 3 'Oregon': 'OR', 4 'Florida': 'FL', 5 'California': 'CA', 6 'New York': 'NY', 7 'Michigan': 'MI' 8...

2017-02-15 22:03:00 113

转载 EX38

1 ten_things = "Apples Oranges Crows Telephone Light Sugar" 2 3 print "Wait there's not 10 things in that list, let's fix that." 4 5 stuff = ten_things.split(' ') 6 more_stuff = ["...

2017-02-13 21:53:00 97

转载 EX35

1 from sys import exit 2 3 def gold_room(): 4 print "This room is full of gold. How much do you take?" 5 6 next = raw_input("> ") 7 if "0" in next or "1" in ne...

2017-02-09 22:06:00 88

转载 EX33

1 i = 0 2 numbers = [] 3 4 while i < 6: 5 print "At the top i is %d" % i 6 numbers.append(i) 7 8 i = i + 1 9 print "Numbers now: ", numbers10 print "...

2017-02-09 22:03:00 150

转载 EX32

1 the_count = [1, 2, 3, 4, 5] 2 fruits = ['apples', 'oranges', 'pears', 'apricots'] 3 change = [1, 'pennies', 2, 'dimes', 3, 'quarters'] 4 5 # this first kind of for-loop goes through...

2017-02-08 22:24:00 122

转载 EX31

1 print "You enter a dark room with rwo door.s do you go through door #1 or door #2?" 2 3 door = raw_input("> ") 4 5 if door == "1": 6 print "There's a giant bear here eatin...

2017-02-05 21:24:00 148

转载 EX30

1 people = 30 2 cars = 40 3 buses = 15 4 5 if cars > people: 6 print "We should take the cars." 7 elif cars < people: 8 print "We should not take the cars." 9 el...

2017-02-04 22:13:00 109

转载 EX29

1 people = 20 2 cats = 30 3 dogs= 15 4 5 if people < cats: 6 print "Too many cats! The world is doomed!" 7 8 if people > cats: 9 print "Not many cats! The...

2017-02-03 21:48:00 99

转载 ex26

以下就原代码(有错误的已经加粗显示) 1 def break_words(stuff): 2 """This function will break up words for us.""" 3 words = stuff.split(' ') 4 return words 5 6 def sort_words(words): 7 ...

2017-02-01 11:00:00 113

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除