码迷,mamicode.com
首页 > 其他好文 > 详细

组合数据类型练习

时间:2018-03-22 13:35:37      阅读:97      评论:0      收藏:0      [点我收藏+]

标签:合数   字符串   数据   元组   list   this   ring   abc   lis   

‘‘‘字符串‘‘‘
str = "This is a string"
for i in str:
    print(i)
 
‘‘‘列表‘‘‘
list = [‘a‘,‘b‘,‘c‘,‘hasee‘]
for i in list:
    print(i)
 
‘‘‘元组‘‘‘
tup = (‘a‘,‘b‘,123,‘hasee‘)
for i in tup:
    print(i)
 
‘‘‘字典‘‘‘
dict = {‘jakey‘:1,‘imp‘:2}
for k,v in dict.items():
    print(k,v)
 
‘‘‘集合‘‘‘
se = set(‘abc‘)
for i in se:
    print(i)

 

组合数据类型练习

标签:合数   字符串   数据   元组   list   this   ring   abc   lis   

原文地址:https://www.cnblogs.com/guoyaowen/p/8622900.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!