摘要: 例如: deftest(): withopen(r"D:/PythonCode/sequence_tagging-master/data/hhhh.txt")asfr: forlineinfr: line=line.strip() yieldline fori,xinenumerate(test()): print(i,x) 阅读全文
posted @ 2019-01-09 20:45 simple_wxl 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 调用static_rnn实际上是生成了rnn按时间序列展开之后的图。打开tensorboard你会看到sequence_length个rnn_cell stack在一起,只不过这些cell是share weight的。因此,sequence_length就和图的拓扑结构绑定在了一起,因此也就限制了每 阅读全文
posted @ 2019-01-09 16:14 simple_wxl 阅读(2194) 评论(0) 推荐(0) 编辑
摘要: 集合update方法:是把要传入的元素拆分,做为个体传入到集合中,例如: >>> a = set('boy') >>> a.update('python') >>> a set(['b', 'h', 'o', 'n', 'p', 't', 'y']) set a & set b 两个集合取交集 up 阅读全文
posted @ 2019-01-09 14:13 simple_wxl 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 假设有如下一个python类: class Foo(object): def __a(self): print "Bet you can't see me..." def bar(self): self.__a() 而s是Securityp的一个实例,我们 s._Foo__a() 这种机制可以阻止继 阅读全文
posted @ 2019-01-09 13:38 simple_wxl 阅读(2576) 评论(0) 推荐(0) 编辑
摘要: logging与print 区别,为什么需要logging? 在写脚本的过程中,为了调试程序,我们往往会写很多print打印输出以便用于验证,验证正确后往往会注释掉,一旦验证的地方比较多,再一一注释比较麻烦,这样logging就应运而生了,直接把验证信息存在一个文件中(例如在logging.basi 阅读全文
posted @ 2019-01-09 12:12 simple_wxl 阅读(281) 评论(0) 推荐(0) 编辑