知识点 :网络通信,socket的应用,udp和tcp发送和接收数据,网络通信过程,广播,三次握手四次挥手,并发服务器,数据库MySQl的安装和一些增删改查的基本操作,生成数据,数据可视化等等
代码 :# import matplotlib.pyplot as plt
# input_values = [1,2,3,4,5]
# squares = [1,4,9,16,25]
# plt.plot(input_values,squares,linewidth = 5)
# # plt.plot(squares,linewidth = 10)
# plt.title('Square Numbers',fontsize = 24)
# plt.xlabel('Value',fontsize = 24)
# plt.ylabel('Square of Value',fontsize = 14)
# plt.tick_params(axis='both',labelsize = 14)
# plt.show()
# x_value = [1,2,3,4,5]
# y_value = [1,4,9,16,25]
# x_value = list(range(1,1001))
# y_value = [x ** 2 for x in x_value]
# plt.scatter(x_value,y_value,c = y_value,cmap = plt.cm.Blues,edgecolor='none',s=40)
# # plt.scatter(x_value,y_value,s=40)
# plt.title('Suare Numbers',fontsize = 24)
# plt.xlabel('Value',fontsize = 14)
# plt.ylabel('Square of Value',fontsize = 14)
# plt.tick_params(axis='both',which = 'major',labelsize = 14)
# plt.axis([0,1100,0,1100000])
# plt.savefig('squares_plot.png',bbox_inches = 'tight')
# from random import choice
#
# class Randomwork:
# def __init__(self,num_points = 5000):
# self.num_points = num_points
# self.x_values = [0]
# self.y_values = [0]
# def fill_walk(self):
# while len(self.x_values) < self.num_points:
# x_direction = choice([1,-1])
# x_distance = choice([0,1,2,3,4])
# x_step = x_direction * x_distance
#
# y_direction = choice([1,-1])
# y_distance = choice([0,1,2,3,4])
# y_step = y_direction * y_distance
#
# if x_step == 0 and y_step == 0:
# continue
# next_x = self.x_values[-1] + x_step
# next_y = self.y_values[-1] + y_step
#
# self.x_values.append(next_x)
# self.y_values.append(next_y)
# import matplotlib.pyplot as plt
# rw = Randomwork()
# rw.fill_walk()
# plt.scatter(rw.x_values,rw.y_values,s = 15)
# plt.show()
# while True:
# rw = Randomwork(50000)
# rw.fill_walk()
# plt.figure(dpi=128,figsize=(10,6))
# point_numbers = list(range(rw.num_points))
# plt.scatter(rw.x_values,rw.y_values,c = point_numbers,cmap = plt.cm.Blues,edgecolors='none',s = 1)
# plt.scatter(0,0,c = 'green',edgecolors='none',s = 100)
# plt.scatter(rw.x_values[-1],rw.y_values[-1],c = 'red',edgecolors='none',s = 100)
# plt.axes().get_xaxis().set_visible(False)
# plt.axes().get_yaxis().set_visible(False)
# plt.show()
#
# keep_running = input('Make another walk?(y/n):')
# if keep_running == 'n':
# break
# from random import randint
# import pygal
# class Die:
# def __init__(self,num_sides = 6):
# self.num_sides = num_sides
# def roll(self):
# return randint(1,self.num_sides)
#
# die1 = Die()
# die2 = Die(10)
# results = []
# for roll_num in range(50000):
# result = die1.roll() + die2.roll()
# results.append(result)
# # print(results)
#
# frequencies = []
# max_result = die1.num_sides + die2.num_sides
# for value in range(2,max_result + 1):
# frequency = results.count(value)
# frequencies.append(frequency)
# print(frequencies)
#
# hist = pygal.Bar()
#
# hist.title = "Result of rolling a D6 and a D10 50000 times."
# hist.x_labels = ['2','3','4','5','6','7','8','9','10','11','12','13','14','15','16']
# hist._x_title = 'Result'
# hist._y_title = 'Frenquency of Result'
#
# hist.add('D6 + D10',frequencies)
# hist.render_to_file('die_visual.svg')
总结 :通过今天的学习,了解到了网络通信的一些理论,并且进一步的接触到了网络通信编程,学会了mysql数据库的一些基本的操作,还有生成数据图表,实现数据可视化等等