10 2017 档案

摘要:单个form子句string[] values = { "LINQ学习", "LINQ基本语句", "from子句", "单个from子句" }; var value = from v in values where v.IndexOf("LINQ") > -1 //包含字符串 select new 阅读全文
posted @ 2017-10-31 14:48 任飞儿 阅读(519) 评论(0) 推荐(0)
摘要:2.绝版线程池设计思路:运用队列queue a.队列里面放任务 b.线程一次次去取任务,线程一空闲就去取任务 import queueimport threadingimport contextlibimport time StopEvent = object() class ThreadPool( 阅读全文
posted @ 2017-10-31 10:16 任飞儿 阅读(216) 评论(0) 推荐(0)
摘要:1.low版线程池设计思路:运用队列queue 将线程类名放入队列中,执行一个就拿一个出来import queueimport threading class ThreadPool(object): def __init__(self, max_num=20): self.queue = queue 阅读全文
posted @ 2017-10-31 10:11 任飞儿 阅读(203) 评论(0) 推荐(0)
摘要:1、进程与线程优、缺点的比较总言:使用进程和线程的目的,提高执行效率。 进程: 优点:能利用机器的多核性能,同时进行多个操作。 缺点:需要耗费资源,重新开辟内存空间,耗内存。 线程: 优点:共享内存(资源),做IO操作时,可以创造并发操作。 缺点:抢占资源。 总结:进程并不是越多越好,最好CPU个数 阅读全文
posted @ 2017-10-30 16:09 任飞儿 阅读(184) 评论(0) 推荐(0)
摘要:Python中,专门用于HTML/XML解析的库; 特点是: 即使是有bug,有问题的html代码,也可以解析。 BeautifulSoup主要有两个版本 BeautifulSoup 3 之前的,比较早的,是3.x的版本。 BeautifulSoup 3的在线文档 最新的,可用的,在线文档是: ht 阅读全文
posted @ 2017-10-27 17:52 任飞儿 阅读(309) 评论(0) 推荐(0)
摘要:自python2.6开始,新增了一种格式化字符串的函数str.format() 语法 它通过{}和:来代替%。 “映射”示例 通过位置 字符串的format函数可以接受不限个参数,位置可以不按顺序,可以不用或者用多次,不过2.6不能为空{},2.7才可以。 通过关键字参数 通过对象属性 通过下标 有 阅读全文
posted @ 2017-10-27 10:46 任飞儿 阅读(202) 评论(0) 推荐(0)
摘要:获取标签名 h1 class 是h1usersoup.find(name="h1", attrs={"class":"h1user"});获取标签的内容h1userSoup.string; __str__ 使用class Student(object): def __init__(self, nam 阅读全文
posted @ 2017-10-26 17:25 任飞儿 阅读(595) 评论(0) 推荐(0)
摘要:SQLite中的时间日期函数这是我学习SQLite时做的笔记,参考并翻译了Chris Newman写的《SQLite》中的《Working with Dates and Times》部分内容。SQLite包含了如下时间/日期函数:datetime().......................产生 阅读全文
posted @ 2017-10-26 14:18 任飞儿 阅读(292) 评论(0) 推荐(0)
摘要:cx = sqlite3.connect("c:/数据库地址") # 打开数据库cu = cx.cursor()# delete the rowcu.execute("delete from user where username=='majuan'")# Save (commit) the cha 阅读全文
posted @ 2017-10-25 15:24 任飞儿 阅读(602) 评论(0) 推荐(0)
摘要:cx = sqlite3.connect("c:/数据库地址") # 打开数据库cu = cx.cursor()# query the tablerows = cu.execute("select * from user")# print the tablefor row in rows: prin 阅读全文
posted @ 2017-10-25 15:19 任飞儿 阅读(405) 评论(0) 推荐(0)
摘要:cx = sqlite3.connect("c:/数据库名字")#打开数据库cu = cx.cursor()cu.execute("INSERT INTO [user] VALUES('乔任梁', '123', '123','测试','122','111')")#新增sqlcx.commit() 阅读全文
posted @ 2017-10-25 14:14 任飞儿 阅读(633) 评论(0) 推荐(0)
摘要:.NET Framework 3.5的新特性 Language Integrated Query,即语言集成查询 查询 和语言结合关系数据库里的信息使用的XML文档保存在本地的DataSet内存中的List列表 LINQ中最基本的数据单元是sequences和elements。一个sequence是 阅读全文
posted @ 2017-10-24 09:33 任飞儿 阅读(169) 评论(0) 推荐(0)
摘要:XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlPath); //取根结点 var root = xmlDoc.DocumentElement;//取到根结点 //取指定的单个结点 XmlNode oldChild = xmlDoc.Se 阅读全文
posted @ 2017-10-23 11:23 任飞儿 阅读(395) 评论(0) 推荐(0)
摘要:xml的节点默认是不允许修改的,本文也就不做处理了 XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlPath); XmlElement element = (XmlElement)xmlDoc.SelectSingleNode("Book 阅读全文
posted @ 2017-10-23 11:19 任飞儿 阅读(266) 评论(0) 推荐(0)
摘要:删除节点 XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlPath); var root = xmlDoc.DocumentElement;//取到根结点 var element = xmlDoc.SelectSingleNode("Bo 阅读全文
posted @ 2017-10-23 11:12 任飞儿 阅读(591) 评论(0) 推荐(0)
摘要:XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlPath); var root = xmlDoc.DocumentElement;//取到根结点 XmlElement node = (XmlElement)xmlDoc.SelectSin 阅读全文
posted @ 2017-10-23 11:07 任飞儿 阅读(230) 评论(0) 推荐(0)
摘要:XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlPath); var root = xmlDoc.DocumentElement;//取到根结点 XmlNode newNode = xmlDoc.CreateNode("element", 阅读全文
posted @ 2017-10-23 11:04 任飞儿 阅读(151) 评论(0) 推荐(0)
摘要:XMLElement 节点XMLDocument 节点的CUID操作 XMLNode 抽象类 操作节点 (XMLElement XMLDocument ) XElement xElement = new XElement( new XElement("BookStore", new XElement 阅读全文
posted @ 2017-10-23 10:40 任飞儿 阅读(227) 评论(0) 推荐(0)
摘要:HashTable 由于是非泛型集合,因此存储进去的都是object类型,不管是键还是值。 Hashtable不允许排序 key不允许重复 键不允许为null Queue和Queue<T> Queue成为队列,队列是这样一种数据结构,数据有列表的一端插入,并由列表的另一端移除。就像单行道,只能从一段 阅读全文
posted @ 2017-10-20 15:32 任飞儿 阅读(229) 评论(0) 推荐(0)
摘要:(IList值的集合 索引访问 ArrayList类IDictionary:键/值对 HashTable类 可变的集合 长度自动增长) ICollection IEnumerable IEnumerable<T>和IEnumerable是所有集合或集合接口的基接口,所有集合接口或集合都继承、实现了它 阅读全文
posted @ 2017-10-20 14:45 任飞儿 阅读(266) 评论(0) 推荐(0)
摘要:避免在索引列上使用计算 where子句中,如果索引列是函数的一部分,优化器将不使用索引而使用全表扫描。例如: (低效)select ... from [dept] where [sal]*12>25000; (高效)select ... from [dept] where [sal]>25000/1 阅读全文
posted @ 2017-10-16 17:17 任飞儿 阅读(126) 评论(0) 推荐(0)