摘要:
异常即是一个事件,会影响程序的正常运行,运行中的错误,采用try/except语句检查 阅读全文
摘要:
1.使用xpath从html文档得到其中元素: <a href="www.abidu.com">123we</a>为了得到其中的123we元素 tree=html.fromstring(***.text) tt=list(set(tree.xpath("//a[@href='www.abidu.co 阅读全文
摘要:
1.tile(A,res)将数组进行重复,tile(Matrix,(m,n)),将其扩展成任一行 2.shape[0] 数组的第维维数, 3.sum(axis=0)将数组对应的列相加,axis=1,对应的行进行相加 4.argsort(x,axis=0)将数组X进行按列升序排序,x换为-x表示按列降 阅读全文
摘要:
1.不使用锁的话,可能会产生线程的竞争:当共享一个对象(变量或者一个方法)加锁的操作 在threading模块中,定义两种类型的琐:threading.Lock和threading.RLock。它们之间有一点细微的区别,通过比较下面两段代码来说明:import threading lock = th 阅读全文
摘要:
anagram 相同字母异序词。heart vs earth 1.Our first solution to the anagram problem will check to see that each character in the first string actually occurs i 阅读全文