witch

Python : 标准库-数据压缩

匿名 (未验证) 提交于 2019-12-02 22:51:30
以下模块直接支持通用的数据打包和压缩格式:zlib,gzip,bz2,zipfile,以及 tarfile。 import zlib s = b’witch which has which witches wrist watch’ len(s) 41 t = zlib.compress(s) len(t) 37 zlib.decompress(t) b’witch which has which witches wrist watch’ zlib.crc32(s) 226805979 文章来源: https://blog.csdn.net/weixin_44523387/article/details/92164215

简单工厂模式

…衆ロ難τιáo~ 提交于 2019-11-29 01:35:11
1 namespace UnitTestProject1 2 { 3 4 /// <summary> 5 /// 简单工厂模式的缺点: 6 /// 增加具体产品时,需要修改工厂类里面生成具体产品的方法,这就违反了开闭原则。具体产品经常发生变化时,不建议使用简单工厂模式。 7 /// 8 /// </summary> 9 [TestClass] 10 public class simpleDesign 11 { 12 [TestMethod] 13 public void TestMethod1() 14 { 15 IPeople people = new PeopleFactory().NewInstance(1); 16 people.SayHello(); 17 } 18 } 19 20 public interface IPeople 21 { 22 void SayHello(); 23 } 24 25 public class ChinesePeople : IPeople 26 { 27 public void SayHello() 28 { 29 Console.WriteLine("早上好,吃了吗"); 30 } 31 } 32 33 public class EnglandPeople : IPeople 34 { 35 public void SayHello(