学习了元祖,写了小程序。
#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"
后面的注释用英文写的,不对勿喷!