摘要:
'''以太网协议ethernet规定: 一组电信号构成一个数据包,叫做‘帧’ 每一数据帧分成:报头head和数据data两部分head包含:(固定18个字节) 发送者/源地址,6个字节 接收者/目标地址,6个字节 数据类型,6个字节data包含:(最短46个字节,最长1500个字节) 数据包的具体内 阅读全文
摘要:
'''异常是错误发出的信号,一旦程序出错,就会产生一个异常,应用程序未处理该异常,异常便会抛出,程序随之终止'''# x'''NameError: name 'x' is not defined'''# if 1>2# pass'''语法错误应该在程序运行前修正SyntaxError: invali 阅读全文
摘要:
# l=list([1,2,3,4])# print(l)## class Foo:# pass# obj=Foo()# print(obj)'''[1, 2, 3, 4]<__main__.Foo object at 0x000001F70F1C2F48>'''# class People:# d 阅读全文
摘要:
# l=list([])# print(type(l)is list)# print(isinstance(l,list))'''True'''# class Foo:# pass# class Bar(Foo):# pass## print(issubclass(Bar,Foo))'''True' 阅读全文
摘要:
# import settings# class MySQL:# def __init__(self,host,port):# self.host=host# self.port=port## @classmethod# def from_conf(cls):# return cls(setting 阅读全文
摘要:
# class Foo:# __N=1# def __init__(self,x,y):# self.x=x# self.__y=y## def __f1(self):# print('f1')## def f2(self):# print(self.__N,self.__y)# print(Foo 阅读全文
摘要:
'''多态:同一种事物的多种形态'''# import abc# class Animal(metaclass=abc.ABCMeta):# @abc.abstractmethod# def speak(self):# pass# class Pig(Animal):# def speak(self 阅读全文
摘要:
# class OldboyPeople:# school = 'oldboy'# def __init__(self,name,age,gender):# self.name=name# self.age=age# self.gender=gender# def tell_info(self):# 阅读全文
摘要:
# 广度优先# class A(object):# def test(self):# print('from A')# class B(A):# def test(self):# print('from B')# class C(A):# def test(self):# print('from C 阅读全文
摘要:
# class Animal:# def eat(self):# pass# def run(self):# pass## class People(Animal):# def eat(self):# print('people is eating')# def run(self):# print( 阅读全文