#coding=utf-8
#!/usr/bin/python

final_list = ('a', 1, 'b', 2, 'c', 3);

print final_list[0];
print final_list[1:3];
print final_list * 2;
print final_list + final_list + final_list;

# 原组不能被重新赋值
# TypeError: 'tuple' object does not support item assignment
# final_list[0] = 'z';

# 遍历
print('for each method 1 : ');
for data in final_list:
    print data;

print('for each method 2 : ');
for i in range(0, len(final_list)) :
        print final_list[i];

 

相关文章:

  • 2022-12-23
  • 2021-05-09
  • 2021-11-10
  • 2021-05-16
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2022-02-12
猜你喜欢
  • 2021-10-27
  • 2021-07-25
  • 2021-12-09
  • 2021-09-26
  • 2022-12-23
  • 2021-08-18
  • 2021-11-29
相关资源
相似解决方案