python 3 元组

1、创建元祖

tup1 = ('jenkins','mysql')
print(tup1)


ssh://[email protected]:22/usr/bin/python -u /home/progect/app/py_code/test1.py
('jenkins', 'mysql')

Process finished with exit code 0


2、访问元祖

tup1 = ('jenkins','mysql')
print(tup1[0])

ssh://[email protected]:22/usr/bin/python -u /home/progect/app/py_code/test1.py
jenkins

Process finished with exit code 0

3、遍历元组

tup1 = ('jenkins','mysql','redis')
for my_info in tup1:
    print(my_info)












  

猜你喜欢

转载自www.cnblogs.com/effortsing/p/10092266.html