大数据第四次作业

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

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

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

时间: 2024-08-06 05:19:48

大数据第四次作业的相关文章

大数据第四天作业

1.将按位运算操作,尤其是左移和右移(有无符号)整理到自己的博客中. 重点说明清晰负数的运算过程. 答:java中对于字节的移位操作按方向分为左移和右移,其中对于右移动操作又分为有符号右移和无符号右移. 1.有符号右移:将二进制向右移动 如果原来符号位为0 则新符号位也用0 否则用1; 2.无符号右移:将二进制向右移动 不管原来的符号位是0还是1 一律用0 补位; 此外对于数值的移位操作,每向右移动一位表示除二,向左移动一位表示乘二. 2.byte数到十六进制字符串表现形式程序设计原理和实现方式

大数据【四】MapReduce(单词计数;二次排序;计数器;join;分布式缓存)

   前言: 根据前面的几篇博客学习,现在可以进行MapReduce学习了.本篇博客首先阐述了MapReduce的概念及使用原理,其次直接从五个实验中实践学习(单词计数,二次排序,计数器,join,分布式缓存). 一 概述 定义 MapReduce是一种计算模型,简单的说就是将大批量的工作(数据)分解(MAP)执行,然后再将结果合并成最终结果(REDUCE).这样做的好处是可以在任务被分解后,可以通过大量机器进行并行计算,减少整个操作的时间. 适用范围:数据量大,但是数据种类小可以放入内存. 基

大数据的四个基本特征

  大数据(big data)是指无法在可承受的时间范围内用常规软件工具进行捕捉.管理和处理的数据集合. 1. 数据量大.TB,PB,乃至EB等数据量的数据需要进行数据分析处理. 2. 要求快速响应.市场变化快,要求能及时快速的响应变化,那对数据分析也要快速,在性能上有更高要求,所以数据量显得对速度要求有些"大". 3. 数据多样性.不同的数据源,非结构化数据越来越多,需要进行清洗,整理,筛选等操作,变为结构数据. 4. 价值密度低.由于数据采集的不及时,数据样本不全面,数据可能不连续

大数据第四天

特殊流程控制语句break,continue   break 语句   break语句用于终止某个语句块的执行,终止循环体 {    -- break; -- }   break 语句用法举例 public class TestBreak{ public static void main(String args[]){ for(int i = 0; i<10; i++){ if(i==3) break; System.out.println(" i =" + i); } Syst

大数据第6天作业

1.使用抽象类和接口实现适配器模式设计.涉及的类和接口分别为ButtonListener(接口), 其中含有click() / dbclick() / keyUp() / keyDown()等方法. ButtonAdapter(按钮适配器类),适配器中对非click()方法进行默认实现. Button类中添加addListener(ButtonListener l)方法. interface ButtonListener { public void click(); public void db

大数据第三天作业

1.定义一个函数,函数功能是动态提取int[]中元素的最大值. public class Main { /**  * 定义一个函数,函数功能是动态提取int[]中元素的最大值.  */ public static void main(String[] args) { //定义数组 int[] nums = new int[5]; //初始化数组 for(int i= 0;i<5;i++){ nums[i] = i; } int max = getMax(nums); System.out.pri

大数据Java基础第六天作业

第一题: interface ButtonListener{     public void click();     public void dbclick();     public void keyup();     public void keydown(); } abstract class ButtonAdapter implements ButtonListener{     public void dbclick(){         //...空实现     }     pub

如何在SharePoint2010中实现大数据存储(四步完成RBS解决方案)

第一步.开启数据库的FILESTREAM支持 实际环境为Sharepoint2010 和 SQL Server2008 R2:数据库默认安装的时候可能没有开启FILESTREAM,此时需要我们核实是否已经开启.打开SQL配置管理器,如下图所示 在开启FILESTREAM之后,在数据库中执行下列语句 EXEC sp_configure filestream_access_level, 2RECONFIGURE 第二.配置内容数据库与文件系统的映射 use [WSS_Content]if not e

大数据第七天作业

利用白富美接口案例,土豪征婚使用匿名内部类对象实现. interface Iwhite { public void white(); } interface Irich { public void rich(); } interface Ibeauti { public void beauti(); } interface WRB extends Iwhite,Irich,Ibeauti { } class WomenStar implements WRB { public void white