list转为tuple:
temp_list = [1,2,3,4,5]
将temp_list进行强制转换:tuple(temp_list)
查看是否转换成功:print type(temp_list)
tuple 转为list:
temp_tuple = (1,2,3)
方法类似,也是进行强制转换即可:list(temp_tuple)
查看是否转换成功:print type(temp_tuple)
list转为tuple:
temp_list = [1,2,3,4,5]
将temp_list进行强制转换:tuple(temp_list)
查看是否转换成功:print type(temp_list)
tuple 转为list:
temp_tuple = (1,2,3)
方法类似,也是进行强制转换即可:list(temp_tuple)
查看是否转换成功:print type(temp_tuple)