python摘录
Encal
这个作者很懒,什么都没留下…
展开
-
【python摘录02】if语句和while语句
number = 23 running = True while running: guess = int(raw_input('Enter an integer:')) if guess == number: print 'congratulations, you guessed it.' print "(but you do not win any prizes!)" runni原创 2014-07-21 11:36:26 · 459 阅读 · 0 评论 -
【python摘录01】字符串
# -7654321 # 0123456 world = "abcdefg"; a = world[2]; print "a is " + a; #c b = world[1:3]; print "b is " + b; #bc c = world[:2]; print "c is " + c; #ab d = world[0:]; print "d is " + d;原创 2014-07-21 11:32:48 · 433 阅读 · 0 评论 -
【python摘录03】'引用'和复制
print 'Simple Assignment' shoplist = ['apple', 'mango', 'carrot', 'banana'] mylist = shoplist del shoplist[0] print 'shoplist is', shoplist # mylist is just another name pointing to the same object!原创 2014-07-22 13:54:10 · 549 阅读 · 0 评论