python list tuple知识点

python 有2个比较重要的内置数据类型:list和tuple

想要了解list相关知识点的话,可以看下python列表操作方法

而需要看tuple相关的知识点可以看下:python 元组

有可能有些同学需要查看的是2个内置方法,list和tuple.

list:方法是把对象转化为列表类型。

tuple:方法则是把对象转化为元组类型。

a = 'fwefesfe'

print list(a)
['f', 'w', 'e', 'f', 'e', 's', 'f', 'e']

print tuple(a)
('f', 'w', 'e', 'f', 'e', 's', 'f', 'e')

posted @ 2013-04-06 10:05  老王python  阅读(238)  评论(0编辑  收藏  举报