大数据第四次作业

Posted 区伯

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了大数据第四次作业相关的知识,希望对你有一定的参考价值。

(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)

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




















以上是关于大数据第四次作业的主要内容,如果未能解决你的问题,请参考以下文章

第四次大作业-确定分工,确定目标

第四次作业

第四次作业之代码规范

第四次课作业(整体管理范围管理)

第四次小组报告

2021年人工神经网络第四次作业-第五题:危险品识别