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

组合数据类型综合练习:1.组合数据类型练习

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

标签:dict   post   log   body   综合   key   div   help   arm   

#字符串
s = ‘Hello‘
for i in s:
    print(i)
  
# 列表
ls = [‘p‘, ‘y‘, ‘Char‘, ‘m‘]
for i in ls:
    print(i)
  
# 元组
tup = tuple(‘tuple‘)
for i in tup:
    print(i)
  
# 字典
names = [‘Help‘, ‘Make‘, ‘Charm‘, ‘Better‘]
score = [98, 89, 78, 80]
dic = dict(zip(names, score))
print(dic)
for i in dic:
    print(i)
print(dic.keys())
  
# 集合
s = set(dic.keys())
print(s)
for i in s:
    print(i)

  

组合数据类型综合练习:1.组合数据类型练习

标签:dict   post   log   body   综合   key   div   help   arm   

原文地址:https://www.cnblogs.com/jiesheng/p/8626745.html

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