Pythonのメタグループの詳細
tuple1 = (‘play’, ‘algorithm’, ‘python’, 2019, 5.11, ‘python’)
empty_tup = ()
- , , ,
one_item_tup = (‘Tommy’,)
print(‘ :’, tuple1)
print(‘ :’, empty_tup)
print(‘ :’, one_item_tup)
、*、 、
print(‘ 、+、*、 、 ’)
: (‘play’, ‘algorithm’, ‘python’, 2019, 5.11, ‘python’)
: ()
: (‘Tommy’,)
、+、*、 、
,
m = 'play', 'algorithm', 'python', 18+6.6j, -4.24e93
x, y = 1, 2
print('m :', m)
print('x, y :', x, y)
-
m : ('play', 'algorithm', 'python', (18+6.6j), -4.24e+93)
x, y : 1 2
print('len(tuple) min(tuple) max(tuple) ')
print("Str Tuple tuple('Tommy'):", tuple('Tommy'))
-
len(tuple) min(tuple) max(tuple)
Str Tuple tuple('Tommy'): ('T', 'o', 'm', 'm', 'y')
, ?
:
tuple = ('play', 'algorithm', 'python', ['Tommy','ChaoChao'])
print(' tuple :', tuple)
-
Tommy liuzhen153,ChaoChao chaochaoZ tuple[3][0] = ‘liuzhen153’
tuple[3][1] = ‘chaochaoZ’ print(tuple) print(‘ tuple :’,
tuple)
[‘liuzhen153’, ‘chaochaoZ’] wsqStar tuple[3].append(‘wsqStar’)
print(‘ tuple :’, tuple)
-
tuple : ('play', 'algorithm', 'python', ['Tommy', 'ChaoChao'])
('play', 'algorithm', 'python', ['liuzhen153', 'chaochaoZ'])
tuple : ('play', 'algorithm', 'python', ['liuzhen153', 'chaochaoZ'])
tuple : ('play', 'algorithm', 'python', ['liuzhen153', 'chaochaoZ', 'wsqStar'])
-
, , , , 『 』 。
Python ,List ,Tuple 。 , , , tuple List , :
1. , ;
2. () , ;
3. , 0 , ;
4.
: ,