自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 收藏
  • 关注

原创 hadoop集群问题

1.配置集群/分布式环境 集群/分布式模式需要修改 /usr/local/hadoop/etc/hadoop 中的5个配置文件,更多设置项可点击查看官方说明,这里仅设置了正常启动所必须的设置项: slaves、core-site.xml、hdfs-site.xml、mapred-site.xml、yarn-site.xml 。 2.CentOS系统需要关闭防火墙 CentOS系统默认开启了防火墙,在开启 Hadoop 集群之前,需要关闭集群中每个节点的防火墙。有防火墙会导致 ping 得通但 telne

2021-06-24 23:13:54 199 2

原创 第九周

class Node(object): def __ini__(self,val): self.val=val self.next=None class LinkedStack(object): def __init__(self): self.top=None def empty(self): return self.top is None def push(self,val):

2021-05-06 11:46:29 116

原创 猜数字界面

import tkinter import tkinter.messagebox root = tkinter.Tk() root.title('猜数字') shuzi=tkinter.StringVar() Label = tkinter.Label(root,text="请输入1到100以内的整数") Label.place(x=20,y=10,width=140,height=40) sg = tkinter.StringVar(root) Entrysg =tkinter.Entry(root,

2020-12-24 08:16:19 95

原创 BMI测试

import tkinter import tkinter.messagebox root = tkinter.Tk() root.title('BMI的测试') bmi=tkinter.StringVar() Label = tkinter.Label(root,text="身高") Label.place(x=20,y=10,width=30,height=20) Label=tkinter.Label(root,text="m") Label.place(x=90,y=10,width=30,heig

2020-12-17 08:22:11 554

原创 计算

import tkinter import tkinter.messagebox def msgbox(): tkinter.messagebox.showinfo(title="xuehao",message=xuehao.get()) root = tkinter.Tk() button=tkinter.Button(root,text='点击弹出',command=msgbox) button.place(x=20,y=20,height=30,width=80) xuehao = t

2020-12-10 10:38:43 100

原创 BMI指标

class BMI: def __init__(self,name,age,weight,high): self.name = name self.age = age self.weight =weight self.high = high def print_bmi1(self): getBMI=self.weight/(self.high*self.high) print("{x}的BMI是

2020-12-10 08:17:46 100

原创

@[TOC](这里写自定义目录标题) # 定义student类 class student: def __init__(self,name,xuehao,phone): self.name=name self.xuehao=xuehao self.phone=phone def say_hello(self): print("你好,我是{n}".format(n=self.name))

2020-12-03 12:15:24 49

原创 约瑟夫

def play(players,step,alive): # 生成一个列表,从[1,.....players] list1=[i for i in range(1,players+1)] # 进入游戏的循环,每次数到step淘汰,step之前的元素移到列表末尾 # 游戏结束的条件:列表剩余人数小于aliv while len(list1)>alive: # 移动step前的元素到列表末尾 num=step

2020-11-26 10:58:31 45

原创 约瑟夫

list2=[i for i in range(40)] del list2[0] print(list2) p=0 a=0 for i in range(1,99): if (len(list2)!=2): if(a==0): p=(len(list2)%3+p)%3 del list2[2:len(list2):3] print(list2) elif(a==1): p

2020-11-26 10:12:43 43

原创 添加行号

```bash # 打开并读取文件 file = open(r'C:/Users/Administrator/Desktop/student.csv','r') lines = file.readlines() # 给每行添加行号 max_len = 0 for line in lines if len(line) > max_len max_len = len(line) print(max_len) line_num = 0 new_lines = [] for

2020-11-25 22:08:42 343

原创 猜数字

```css import random n=int(random.random()*50+1) i=1 while i <= 3: cds=int(input("输入要猜的数字:")) if(cds < n): print("你输入的数小了") i = i + 1 elif(cds > n): print("你输入的数大了") i = i + 1 else: print("猜

2020-11-25 22:08:03 65

原创 打开并读取文件

# 打开并读取文件 file = open(r'C:\Users\Administrator\Desktop\Walden.txt','r') lines = file.readlines() words = [] for line in lines: tmp_list = line.split() for word in tmp_list: # 对word_count字典进行排序,按照出现的次数(value)进行降序排序 # 对words中每一个元素出现的个数 # 把统计结果保存到字典中,

2020-11-25 22:07:26 158

原创 点名

import random import csv data = csv.reader(open('人工智能201名单.csv')) data = dict(data) del data['学号'] num_in = input("要点几个人:") for i in range(int(num_in)): r = int(random.random() * 39 + 1) classmate = data.pop(str(r)) print(r, classmate) ...

2020-11-25 18:34:51 85

原创 统计Walden中单词出现的次数

import collections f=open(r'C:\Users\86156\Desktop\Walden.txt','r') str1=f.read().split(' ') m=collections.Counter(str1) print(m)

2020-11-19 08:14:13 361

原创 添加行号

f=open('demo.py','r').readlines() f_out=open('demo_new.py','w') s=1 for a in f: a=f.replace('\n', '#'+str(s)+'\n') s=s+1 f_out.write(a)

2020-11-19 08:09:59 79

原创 字典、元组、集合的使用

字典的用法 dic1 = {“python3”:123,“10086”:100} 定义字典:字典是一系列的键-值对,键和值之间用冒号隔开,而键-值对之间用逗号隔开。字典的键一般是唯一的,如果出现重复,最后的一个键值对会替换前面的。 dic2 = {“u”:879} print(dic1[“python3”]) 查字典中的元素 dic1 = {“python3”:123,“10086”:100} dic2 = {“u”:879} dic1.items() 查字典中的所有元素 print(dic1) dic1.

2020-11-10 22:30:44 675

原创 猜数字

import random n=int(random.random()*50+1) i=1 while i <= 5: cin=int(input("请输入你要猜的数字:")) if(cin < n): print("你输入的数比较小") i = i + 1 elif(cin > n): print("你输入的数比较大") i = i + 1 else: print("恭喜你猜

2020-11-10 22:28:40 55

原创 while循环语句中continue和break的不同

while 表达式 : 执行的语句1 else : 执行的语句2 break:跳出循环,执行后面的语句 例 i=1 t=i while i<=5 : if t<0: break t = i * (-1) i = i + 1 else : print(“循环结束”)

2020-11-10 22:27:35 65

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除