Pythonベースのユニットtuple
1506 ワード
, tuple , tuple . append(),insert(),pop() , , list , list list
# , tuple , tuple
# append(),insert(),pop()
classMember = ('zhangsan', 'lisi', 'wangwu')
print('classMember:',classMember)
print (' ( )classmates[1]:', classMember[1])
print (' ( )classmates[-2]:', classMember[-2])
print (' classmates[-1]:', classMember[-1])
print (' classmates[len(classmates)-1]:', classMember[len(classMember) - 1])
print (' :',len(classMember))
#
N = ()
print(' N:',len(N))
# 1 tuple , ()
oneNumberTuple = (1,)
print("oneNumberTuple:",oneNumberTuple)
# tuple list,list , ,
# tuple , list 。
# tuple “ ” ,tuple , 。
# 'a', 'b', list, , list !
oneList = ['muyi','san','liang']
anotherTuple = ('zhangsan','lisi',oneList,'wangwu')
print(" :",anotherTuple)
anotherTuple[2][1] = 'shui'
oneList.append(True)
print(" :",anotherTuple)
#
testTuple = (1,2,3)
testAnotherTuple = (4,5,testTuple)
print(testAnotherTuple)
print(' testAnotherTuple[2][1]:', testAnotherTuple[2][1])
print('testTuple[1]:', testTuple[1])
もし不当があれば,指摘してください.