python中创建列表、元组、字符串、字典

时间:2021-02-26 13:17:16   收藏:0   阅读:0

 

1、

>>> a = ["aaa","bbb","ccc"]  ## 列表,中括号,逗号
>>> type(a)
<class list>
>>> b = ("aaa","bbb","ccc")   ## 元组,小括号,逗号
>>> type(b)
<class tuple>
>>> c = "aaabbbccc"       ## 字符串,引号
>>> type(c)
<class str>
>>> d = {"a":"aaa","b":"bbb","c":"ccc"}   ## 字典,大括号,冒号,逗号 ,键值对(当普通索引不好用时用字典)
>>> type(d)
<class dict>

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!