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

大数据第四次作业

时间:2018-03-21 21:10:39      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:键值   bsp   eve   form   rds   learn   post   bee   world   

(1)

addr=‘http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html‘
print(addr[-14:-5])

(2)

addr1=‘https://docs.python.org/3/library/‘
addr2=‘turtle‘
addr3=‘.html‘
print(addr1+addr2+addr3)

(3)

for i in range(1,5):
print(‘http://news.gzcc.cn/html/xiaoyuanxinwen/{}.html‘.format(i))

(4)

addr=‘http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html‘
print(addr.rstrip(‘.html‘).split(‘_‘)[1])

(5)

words="Lately, I‘ve been, I‘ve been losing sleep Dreaming about the things that we could be But baby, I‘ve been, I‘ve been praying hard, Said, no more counting dollars We‘ll be counting stars, yeah we‘ll be counting stars I see this life like a swinging vine Swing my heart across the line And my face is flashing signs Seek it out and you shall find Old, but I‘m not that old Young, but I‘m not that bold I don‘t think the world is sold I‘m just doing what we‘re told I feel something so right Doing the wrong thing I feel something so wrong Doing the right thing I could lie, coudn‘t I, could lie Everything that kills me makes me feel alive Lately, I‘ve been, I‘ve been losing sleep Dreaming about the things that we could be But baby, I‘ve been, I‘ve been praying hard, Said, no more counting dollars "
print(words.count(‘counting‘))

(6)

words=‘this is my first my first time learning python‘
print(words.split())

(7)

list=[‘Tom‘,‘Nacy‘,‘Jackson‘,‘Kity‘]
for i in list:
print("%s:%s"%(list.index(i)+1,i))

 

tuple=[‘Tom‘,‘Nacy‘,‘Jackson‘,‘Kity‘]
for i in tuple:
print("%s:%s" % (tuple.index(i) + 1, i))

 

dict={‘Tom‘:90,‘Nacy‘:88,‘Jackson‘:60}
for key,value in dict.items():
print(‘%s:%s‘ %(key,value))

 

s=set([‘Tom‘,‘Nacy‘,‘Jackson‘,‘Kity‘])
for i in s:
print(i)

 

(8)

元祖用圆括号,列表用方括号,字典用花括号,集合花括号
元祖有序,列表有序,字典无序,集合无序
元祖不可变,列表可变,字典可变,集合可变
元祖元素任意,列表元素任意,字典元素键值对,集合元素任意

大数据第四次作业

标签:键值   bsp   eve   form   rds   learn   post   bee   world   

原文地址:https://www.cnblogs.com/OZX143570/p/8619310.html

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