反射都是操作对象中的__dict__的内容 class Student: def study(self): print("正在学习....") stu = Student() if not hasattr(stu,"name"): setattr(stu,"name","比格") print(stu.name) delattr(stu,"name") # print(stu.name) print(stu.…
从Socket上读取对端发过来的数据一般有两种方法: 1)依照字节流读取 BufferedInputStream in = new BufferedInputStream(socket.getInputStream()); int r = -1; List<Byte> l = new LinkedList<Byte>(); while ((r = in.read()) != -1) { l.add(Byte.valueOf((byte) r)); } 2)依照字符流读取 Buffe…