python 学习心得-3

学习了元祖,写了小程序。

#encoding = utf-8
a = ("success","false","what")
print "first"
print a      #print all string
print "\n"
print "second"
print a[:]   #pirnt all string
print "\n"
print "third"
print a[0]   #print first string
print "\n"
print "fouth"
print a[0:]  #print all string
print "\n"
print "fifth"
print a[0:1] #print first string
print "\n"
print "sixth"
print a[0:2] #print fore two string
print "\n"
print "sevnth"
print a[0:3] #print all string
print "\n"
print "eighth"
print a[-1]  #print "what" string
print "\n"
print "ninth"
print a[-2]  #print "false" string
print "\n"
print "tenth"
print a[-3]  #print "success" string
print "\n"
print "eleventh"
print a[-3:-1] #print "sucess and false" string
print "\n"
print "twelfth"
print a[-3:-1:1] #print print "sucess and false" string
print "\n"
后面的注释用英文写的,不对勿喷!

python 学习心得-3,布布扣,bubuko.com

python 学习心得-3

上一篇:Java如何将图片打包到jar中


下一篇:[leetcode]Edit Distance @ Python