04 2018 档案

摘要:一. 1/在本地Linux文件系统的“/home/hadoop/”目录下创建一个文件txt,里面可以随意输入一些单词. cd /usr/local/hadoop 2.在本地查看文件位置(ls) touch test.txt 3.在本地显示文件内容 cat test.txt 4.使用命令把本地文件系统中的“txt”上传到HDFS中的当前用户目录的input目录下 ./sbi... 阅读全文
posted @ 2018-04-26 10:39 248黄迎迎 阅读(154) 评论(0) 推荐(0) 编辑
摘要:def getWordColod(wc): image = Image.open('./movie.png') graph = np.array(image) font = r'C:\Windows\Fonts\simhei.TTF' wc = WordCloud(font_path=font, b 阅读全文
posted @ 2018-04-21 00:46 248黄迎迎 阅读(497) 评论(0) 推荐(0) 编辑
摘要:1. 将新闻的正文内容保存到文本文件。 def getNewsDetail(content): f=open('gzcc.txt','a',encoding='utf-8') f.write(content) f.close() 2. 将新闻数据结构化为字典的列表: #获取新闻详情信息 def getNewsDetail(newsUrl): resd... 阅读全文
posted @ 2018-04-17 22:00 248黄迎迎 阅读(121) 评论(0) 推荐(0) 编辑
摘要:1. 用正则表达式判定邮箱是否输入正确。 q='^(\w)+(\.\w+)*@(\w)+((\.\w{2,3}){1,3})$' qq='1280163615@qq.com' if re.match(q,qq): print(re.match(q,qq)) else: print("您输入的邮箱号码是错误的,请重新输入!") 2. 用正则表达式识别出全部电话号码... 阅读全文
posted @ 2018-04-10 17:41 248黄迎迎 阅读(111) 评论(0) 推荐(0) 编辑
摘要:1. 用requests库和BeautifulSoup库,爬取校园新闻首页新闻的标题、链接、正文。 import requests from bs4 import BeautifulSoup url="http://news.gzcc.cn/html/xiaoyuanxinwen/" res=requests.get(url) res.encoding='utf-8' soup=Beauti... 阅读全文
posted @ 2018-04-03 17:50 248黄迎迎 阅读(128) 评论(0) 推荐(0) 编辑