#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];
时间: 2024-10-26 11:04:56