diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..bd53818 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3" +} \ No newline at end of file diff --git a/01.md b/01.md deleted file mode 100644 index 8952e2c..0000000 --- a/01.md +++ /dev/null @@ -1,142 +0,0 @@ -> The fear of the LORD is the beginning of knowledge; fools despise wisdom and instruction.(PROVERBS 1:7) - ->敬畏耶和华是只是的开端,愚妄人藐视智慧和训诲。 - -#关于python的故事 - -我已经在[《零基础学python(第一版)》](https://github.com/qiwsir/ITArticles/blob/master/BasicPython/index.md)中写了一个专门讲述python故事的——[唠叨一些关于python的事情](https://github.com/qiwsir/ITArticles/blob/master/BasicPython/001.md)——章节,今天再写类似的标题,不打算完全重复原来的,只是把部分认为重要的或者不可或缺的东西复制过来。 - -##越来越火的Python - -在前几年(before 2011),我跟一些朋友介绍python的时候,看到的常常是一种很诧异的眼神,通常会听到: - - “那时什么东西?” - “解释性语言会不会很慢?” - “没听说谁用呀?” - “能像php,java,c#那样用来做网站吗?” - “什么?你说的是pascal?你还在用这个老古董?” - “哦,我听说过,有一些老外在用,不过我们这还没有人用呢。” - -时过境迁,现在已经有了很大变化。 - -2014年初,我开始写《零基础学python》系列,就得到了很多朋友的支持,而且吸引了不少学习python的朋友,特别是在我的那个QQ群里面,集中了不少学习者和爱好者,当然也有高手深藏不露。 - - 获得我发布的有关python信息途径: - 1. 加入QQ群,里面可以跟很多人交流。QQ群:Code Craft:26913719 - 2. 关注我的新浪微博,名称是:老齐Py。地址:[http://weibo.com/qiwsir](http://weibo.com/qiwsir) - 3. 到github.com上直接follow我,名称是:qiwsir。地址:[https://github.com/qiwsir](https://github.com/qiwsir) - 4. 经常关注我的网站:[www.itdiffer.com](http://www.itdiffer.com) - -特别是今年(2015年)一开始,在QQ群(26913719)里面,就有朋友说,他在上海找工作,看到好多公司都要有python开发经验的。也有朋友委托我推荐python程序员的。 - -从我自己的经历中也感受到,不仅仅是国外,国内也如此,用python的领域越来越多,找pythoner的公司和机构也越来越多了。 - -所以,学习python,挺好(包括女生,也是“挺”好)。 - -##需要什么基础吗 - -这是很多初学者都会问的一个问题。诚然,在计算机方面的基础越好,对学习任何一门新的编程语言,都是更有利的。如果,你在编程语言的学习上,属于零基础,也不用担心,不管用哪门语言作为学习编程的入门语言,总要有一个开始吧。 - -就我个人来看,python是比较适合作为学习编程的入门语言的。换言之,就是不用担心自己的所谓基础问题。 - -看我这个课程的标题,就是强调“零基础”的。 - -不仅我这么认为,美国有不少高校也这么认为,纷纷用python作为编程专业甚至是非编程专业的大学生入门语言。 - -我跟很多计算机专业的大学生朋友聊过,他们比较痛苦的就是大学用C语言作为编程入门语言,学了这个,才知道自己不适合学习编程,因为直到课程完毕,甚至考试通过了(一般是师生一块糊里糊涂地通过),对编程这件事也还是雾里看花的那种感觉。当然,或许你不在此列,一来你有天分,二来你下了功夫。 - -总而言之,学习python,你不用担心基础问题。**特别是在这里学习,我的后续内容,就是从零基础开始的**。 - -##优雅的python - -python号称是优雅的。但是这种说法仁者见仁智者见智。比如经常听到大师们说“数学美”,是不是谁都能体验到呢?不见得吧。 - -所以,是不是优雅,是不是简单,是不是明确,只有“谁用谁知道”。 - -不过,我特别喜欢下面这句话:**人生苦短,我用python**。意思就是说,python能够提高开发效率,让你短暂的人生能够除了工作之外,还有更多的时间休息、娱乐或者别的什么。 - -或许有的人不相信,那么也只有“谁用谁知道了”。 - -##跟别的语言比较 - -“如果你遇到的问题无法用python解决,这个问题也不能用别的语言解决。”——这是我向一些徘徊在python之外的人常说的,是不是有点夸张了呢? - -最近看到了一篇文章,[《如果变成语言是女人》](http://www.vaikan.com/if-programming-languages-are-woman/),我转载如下(考虑到篇幅所限,所了适当删改,非删减请通过连接查看原文): - -![](./0images/01.jpg) - ->PHP是你的豆蔻年华的心上人,她是情窦初开的你今年夏天傻乎乎的追求的目标。玩一玩可以,但千万不要投入过深,因为这个女孩有严重的问题。 - ->Ruby是脚本家族中一个非常漂亮的孩子。第一眼看她,你的心魄就会被她的美丽摄走。她还很有有趣。起初她看起来有点慢,不怎么稳定,但近些年来她已经成熟了很多。 - ->Python 是Ruby的一个更懂事的姐姐。她优雅,新潮,成熟。她也许太过优秀。很多小伙都会说“嘿,兄弟,你怎么可能不爱上Python呢!?”。没错,你喜欢Python。你把她当成了一个脾气和浪漫都退烧了的Ruby。 - ->Java是一个事业成功的女人。很多在她手下干过的人都感觉她的能力跟她的地位并不般配,她更多的是通过技巧打动了中层管理人员。你也许会认为她是很有智慧的人,你愿意跟随她。但你要准备好在数年里不断的听到“你用错了接口,你遗漏了一个分号”这样的责备。 - ->C++ 是Java的表姐。她在很多地方跟Java类似,不同的是她成长于一个天真的年代,不认为需要使用“保护措施”。当然,“保护措施”是指自动内存管理。你以为我指的是什么? - ->C 是C++的妈妈。对一些头发花白的老程序员说起这个名称,会让他们眼睛一亮,产生无限回忆。 - ->Objective C C语言家族的另外一个成员。她加入了一个奇怪的教会,不愿意和任何教会之外的人约会。 - -虽然是娱乐,或许有争议,权当参考吧。 - -##The Zen of Python - -这就是著名的《python之禅》。 - ->Beautiful is better than ugly. - ->Explicit is better than implicit. - ->Simple is better than complex. - ->Complex is better than complicated. - ->Flat is better than nested. - ->Sparse is better than dense. - ->Readability counts. - ->Special cases aren't special enough to break the rules. - ->Although practicality beats purity. - ->Errors should never pass silently. - ->Unless explicitly silenced. - ->In the face of ambiguity, refuse the temptation to guess. - ->There should be one-- and preferably only one --obvious way to do it. - ->Although that way may not be obvious at first unless you're Dutch. - ->Now is better than never. - ->Although never is often better than *right* now. - ->If the implementation is hard to explain, it's a bad idea. - ->If the implementation is easy to explain, it may be a good idea. - ->Namespaces are one honking great idea -- let's do more of those! - -##感谢Guido van Rossum - -Guido van Rossum 是值得所有pythoner感谢和尊重的,因为他发明了这个优雅的编程语言。他发明python的过程是那么让人称赞和惊叹,显示出牛人的风采。 - ->1989年的圣诞节期间,吉多·范罗苏姆为了在阿姆斯特丹打发时间,决心开发一个新的脚本解释程序,作为ABC语言的一种继承。之所以选中Python作为程序的名字,是因为他是一个蒙提·派森的飞行马戏团的爱好者。ABC是由吉多参加设计的一种教学语言。就吉多本人看来,ABC这种语言非常优美和强大,是专门为非专业程序员设计的。但是ABC语言并没有成功,究其原因,吉多认为是非开放造成的。吉多决心在Python中避免这一错误,并取得了非常好的效果,完美结合了C和其他一些语言。 - -这段故事的英文刊载在:[https://www.python.org/doc/essays/foreword/](https://www.python.org/doc/essays/foreword/) - -##新版的设想 - -我写《零基础学python(第二版)》,是承接第一版的,并在第一版基础上,最出比较大量的改进,比如每个章节的标题,现在改为更为直接的描述,而不是用那种文艺范写了,因为这样不仅更明确,而且还能用于以后备查。 - -此外,我会继续原有的大家认可的风格,兼顾零基础和后续的发展。特别是要在里面穿插如更多的项目例子。 - -------- - -[总目录](./index.md)   |   [下节:从小工到专家](./02.md) diff --git a/02.md b/02.md deleted file mode 100644 index bbbc3a9..0000000 --- a/02.md +++ /dev/null @@ -1,45 +0,0 @@ ->Do not store up for yourselves treasures on earth, where moth and rust consume and where thieves break in and steal; but store up for yourselves treasures in heaven, where neither moth nor rust consumes and where thieves do not break in and steal. For where your treasure is, there your heart will be also.(MATHEW 10:19-21) - ->不要为自己积攒财宝在地上,地上有虫子咬,能锈坏,也有贼挖窟窿来偷;只要积攒财宝在天上,天上没有虫子咬,不能锈坏,也没有贼挖窟窿来偷。因为的财宝在哪里,你的心也在哪里。 - -#从小工到专家 - -这个标题,我借用了一本书的名字——《程序员修炼之道:从小工到专家》——这本书特别推荐阅读。 - -“从小工到专家”,也是很多开始学习编程的朋友的愿望。如何能实现呢?上面所提到的那本书中,给出了非常好的建议,值得借鉴。 - -我在这里倒是想到了另外一个问题,也是学习python的朋友给我提出来的: - ->“书已经看了,书上的代码也运行过了,习题也能解答了,但是还不知如何开发一个真正的应用程序,不知从何处下手。” - -此外,我在工作中,也遇到过一些刚刚毕业来求职的大学生,从简历上看,相关专业的考试分数是不错的(我一般是相信那些成绩是真的),但是,一讨论到专业问题,常常出乎我的预料。特别是当他面对真是的工作对象时,表现出来的比成绩单差太多了。 - -我一般会武断地下一个结论:练的少。 - -从小工到专家,必经之路就是要多阅读代码,多调试程序。 - -##阅读代码 - -有句话说的好:“读书破万卷,下笔如有神”。这也适用于编程。阅读别人的代码,是必须的。通过阅读别人的代码,“站在巨人的肩膀上”,让自己眼界开阔,思维充实。 - -阅读代码的最好地方就是:www.github.com - -如果你还没有帐号,请尽快注册,他将是你作为一个优秀程序员的起点。当然了,不要忘记来follow我,我的帐号是: qiwsir。 - -阅读代码最好的一个方法是一边阅读,一边进行必要的注释,这是在梳理自己对别人代码的认识。然后,可以run一下,看看效果。当然,还可以按照自己的设想进行必要修改,再run。这样你就将别人的代码消化吸收了。 - -##调试程序 - -首先就是要自己动手写程序。“一万小时定律”在编程领域也是成立的,除非你是天才,否则,只有通过“一万小时定律”才能成为天才。 - -“拳不离手,曲不离口”,小工只有通过勤奋地敲代码才能成为专家。 - -另外,在调试程序的时候,要善于应用网络,看看类似的问题别人如何解决,不要仅仅局限于自己的思维范围。利用网络就少不了搜索引擎。我特别向那些要想成为专家的小工们说:只有google能够帮助你成为专家,其它的搜索引擎,特别是某国内常用的,充其量成为“砖家”,更多的是“砖工”。所以,请用:**google.com**。 - -我在本教程中,会陆续想有意成为专家的朋友提供更多有用的网站或者工具。 - -除了以上两条基本方法之外,成为专家之路还要注意很多呢,不过都是旁枝末节的问题了。以上两条做好,至少在编程上不迷茫了。 - ---------- - -[总目录](./index.md)   |   [上节:关于python的故事](./01.md)   |   [下节:安装python的开发环境](./03.md) diff --git a/03.md b/03.md deleted file mode 100644 index b21e23c..0000000 --- a/03.md +++ /dev/null @@ -1,108 +0,0 @@ ->But Jesus said to them,"Because of your hardness of heart he wrote this commandment for you. But from the beginning of creation, 'God made them male and female.' 'For this reason a man shall leave his father and mother and be joined to his wife, and the two shall become on flesh.' Therefore what God has joined together, let no one separate."(MARK 10:5-9) - -#Python安装 - -任何高级语言都是需要一个自己的编程环境的,这就好比写字一样,需要有纸和笔,在计算机上写东西,也需要有文字处理软件,比如各种名称的OFFICE。笔和纸以及office软件,就是写东西的硬件或软件,总之,那些文字只能写在那个上边,才能最后成为一篇文章。那么编程也是,要有个什么程序之类的东西,要把程序写到那个上面,才能形成最后类似文章那样的东西。 - ->**注:推荐一种非常重要的学习方法** - ->在我这里看文章的零基础朋友,乃至于非零基础的朋友,不要希望在这里学到很多高深的python语言技巧。 - ->“靠,那看你胡扯吗?” - ->非也。重要的是学会一些方法。比如刚才给大家推荐的“上网google一下”,就是非常好的学习方法。互联网的伟大之处,不仅仅在于打打游戏、看看养眼的照片或者各种视频之类的,当然,在某国很长时间互联网等于娱乐网,我忠心希望从读本文的朋友开始,互联网不仅仅是娱乐网,还是知识网和创造网。扯远了,拉回来。在学习过程中,如果遇到一点点疑问,都不要放过,思考一下、尝试一下之后,不管有没有结果,还都要google一下。 - ->列位看好了,我上面写的很清楚,是google一下,不是让大家去用那个什么度来搜索,那个搜索是专用搜索八卦、假药、以及各种穿着很简单衣服的女孩子照片的。如果你真的要提高自己的技术视野并且专心研究技术问题,请用google。当然,我知道你在用的时候会遇到困难,做为一个要在技术上有点成就的人,一定要学点上网的技术的,你懂得。 - ->什么?你不懂?你的确是我的读者:零基础。那就具体来问我吧,不管是加入QQ群还是微博,都可以。 - -欲练神功,挥刀自宫。神功是有前提de。 - -要学python,不用自宫。python不用那么残忍的前提,但是,也需要安装点东西才能用。 - -所需要安装的东西,都在这个页面里面:www.python.org/downloads/ - ->www.python.org是python的官方网站,如果你的英语足够使用,那么自己在这里阅读,可以获得非常多的收获。 - -在python的下载页面里面,显示出python目前有两大类,一类是python3.x.x,另外一类是python2.7.x。可以说,python3是未来,它比python2.7有进步。但是,现在,还有很多东西没有完全兼容python3。更何况,如果学了python2.7,对于python3,也只是某些地方的小变化了。 - -所以,我这里是用python2.7为例子来讲授的。 - -##Linux系统的安装 - -你的计算机是什么操作系统的?自己先弄懂。如果是Linux某个发行版,就跟我同道了。并且我恭喜你,因为以后会安装更多的一些python库(模块),在这种操作系统下,操作非常简单,当然,如果是iOS,也一样,因为都是UNIX下的蛋。只是widows有点另类了。 - -不过,没关系,python就是跨平台的。 - -但是,我还是推荐列位,至少在某种意义上讲,用Linux操作系统是很好的事情。 - -我用Ubuntu。 - -以ubutu14.04为例,一般只要装好了这个操作系统,里面就已经把python安装好了。可能是python2.7.6版本,不过,在我来看,不需要升级,虽然目前最高版本是python2.7.9(在64位的上面,默认也安装了python3,供使用者选择)。 - -接下来就在shell中输入python,如果看到了`>>>`,并且显示出python的版本信息,恭喜你,这就进入到了python的交互模式下。 - -如果非要自己安装。参考下面的操作: - -- 到官方网站下载源码。比如: - - wget http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz - -- 解压源码包 - - tar -zxvf Python-2.7.8.tgz - -- 编译 - - cd Python-2.7.8 - ./configure --prefix=/usr/local #指定了目录,如果不制定,可以使用默认的,直接运行 ./configure 即可。 - make&&sudo make install - -安装好之后,进入shell,输入python,会看到如下: - - qw@qw-Latitude-E4300:~$ python - Python 2.7.6 (default, Nov 13 2013, 19:24:16) #后来我升级到2.7.8了,就是用后面讲到的源码安装方法 - [GCC 4.6.3] on linux2 - Type "help", "copyright", "credits" or "license" for more information. - >>> - -我用的是python2.7.6,或许你的版本号更高。这些差别就不用纠结了。 - -##windows系统的安装 - -到[下载页面里面](https://www.python.org/download/releases/2.7.8/)找到windows安装包,下载之,比如下载了这个文件:python-2.7.8.msi。然后就是不断的“下一步”,即可完成安装。 - -特别注意,安装完之后,需要检查一下,在环境变量是否有python。 - ->如果还不知道什么是windows环境变量,以及如何设置。不用担心,请google一下,搜索:"windows 环境变量"就能找到如何设置了。 - -以上搞定,在cmd中,输入python,得到跟上面类似的结果,就说明已经安装好了。 - -##Mac OS X系统的安装 - -其实根本就不用再写怎么安装了,因为用Mac OS X 的朋友,肯定是高手中的高高手了,至少我一直很敬佩那些用Mac OS X 并坚持没有更换为windows的。麻烦用Mac OS X 的朋友自己网上搜吧,跟前面unbutu差不多。 - -如果按照以上方法,顺利安装成功,只能说明幸运,无它。如果没有安装成功,这是提高自己的绝佳机会,因为只有遇到问题才能解决问题,才能知道更深刻的道理,不要怕,有google,它能帮助列为看官解决所有问题。当然,加入QQ群或者通过微博,问我也可以。 - -就一般情况而言,Linux和Mac OSx 系统都已经安装了某种python的版本,打开就可以使用。但是windows是肯定不安装的。除了可以用上面所说的方法安装,还有一个更省事的方法,就是安装:ActivePython - -简单记录一下我的安装方法(我是在linux系统中做的): - -1. 获得root权限 -2. 到上述地址下载某种版本的python: wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz -3. 解压缩:tar xfz Python-2.7.8.tgz -4. 进入该目录:cd Python-2.7.8 -5. 配置: ./configure -6. 在上述文件夹内运行:make,然后运行:make install -7. 祝你幸运 -8. 安装完毕 - -OK!已经安装好之后,马上就可以开始编程了。 - -最后喊一句在一个编程视频课程广告里面看到的口号,很有启发:“我们程序员,不求通过,但求报错”。 - -还需要补充说明,本教程使用的是python2,虽然跟python3有区别,但是,你不用纠结是2还是3,因为两者区别不是很大,再者,目前工程上应用最多的,还是python2,虽然python3是趋势,毕竟需要时间过渡的。很多初学者特别是大学生喜欢纠缠这个问题,实在有点浪费脑细胞了。 - -------- - -[总目录](./index.md)   |   [上节:从小工到专家](./02.md) diff --git a/0images/n00201.png b/0images/n00201.png new file mode 100644 index 0000000..ec5cfb0 Binary files /dev/null and b/0images/n00201.png differ diff --git a/0images/n00401.png b/0images/n00401.png new file mode 100644 index 0000000..82aa1c4 Binary files /dev/null and b/0images/n00401.png differ diff --git a/101.md b/101.md deleted file mode 100644 index 18287e9..0000000 --- a/101.md +++ /dev/null @@ -1,121 +0,0 @@ ->"But I say to you that listen, Love your enemies, do good to those who hate you, bless those who curse you, pray for those who abuse you. If anyone strikes you on the cheek, offer the other also; and from anyone who takes away your coat do no withhold even your shirt. Give to everyone who begs from you; and if anyone takes away your goods, do not ask for them again. Do to others as you would have them do to you....Be merciful, just as your Father is merciful." - -#集成开发环境(IDE) - -当安装好python之后,其实就已经可以进行开发了。按照惯例,第一行代码总是:Hello World - -##值得纪念的时刻:Hello world - -不管你使用的是什么操作系统,总之肯定能够找到一个地方,运行python,进入到交互模式。 - -像下面一样: - - Python 2.7.6 (default, Nov 13 2013, 19:24:16) - [GCC 4.6.3] on linux2 - Type "help", "copyright", "credits" or "license" for more information. - >>> - -在`>>>`后面输入`print "Hello, World"`,并按回车。这就是见证奇迹的时刻。 - - >>> print "Hello, World" - Hello, World - -如果你从来不懂编程,从这一刻起,就跨入了程序员行列;如果已经是程序员,那么就温习一下当初的惊喜吧. - -`Hello, World`是你用代码向这个世界打招呼了。 - -每个程序员,都曾经经历过这个伟大时刻,不经历这个伟大时刻的程序员不是伟大的程序员。为了纪念这个伟大时刻,理解其伟大之所在,下面执行分解动作: - ->说明:在下面的分解动作中,用到了一个符号:#,就是键盘上数字3上面的那个井号。这个符号,在python编程中,表示注释。所谓注释,就是在计算机不执行那句话,只是为了说明某行语句表达什么意思,是给计算机前面的人看的。特别提醒,在编程实践中,注释是必须的。请牢记:程序在大多数情况下是给人看的,只是偶尔让计算机执行一下。 - - #看到“>>>”符号,表示python做好了准备,当代你向她发出指令,让她做什么事情 - - >>> - - #print,意思是打印。在这里也是这个意思,是要求python打印什么东西 - - >>> print - - #"Hello,World"是打印的内容,注意,量变的双引号,都是英文状态下的。引号不是打印内容,它相当于一个包裹,把打印的内容包起来,统一交给python。 - - >>> print "Hello, World" - - #上面命令执行的结果。python接收到你要求她所做的事情:打印Hello,World,于是她就老老实实地执行这个命令,丝毫不走样。 - - Hello, World - -在python中,如果进入了上面的样式,我们称之为“交互模式”。这是非常有用而且简单的模式,她是我们进行各种学习和有关探索的好方式,随着学习的深入,你越觉得她魅力四射。 - ->笑一笑:有一个程序员,自己感觉书法太烂了,于是立志继承光荣文化传统,购买了笔墨纸砚。在某天,开始练字。将纸铺好,拿起笔蘸足墨水,挥毫在纸上写下了两个打字:Hello World - -虽然进入了程序员序列,但是,如果程序员用的这个工具,也仅仅是打印Hello,World,怎能用“伟大”来形容呢? - -况且,这个工具也太简陋了?你看美工妹妹用的Photoshop,行政妹妹用的word,出纳妹妹用的Excle,就连坐在老板桌后面的那个家伙还用一个PPT播放自己都不相信的新理念呢,难道我们伟大的程序员,就用这么简陋的工具写出旷世代码吗? - -当然不是。软件是谁开发的?程序员。程序员肯定会先为自己打造好用的工具,这也叫做近水楼台先得月。 - -IDE就是程序员的工具。 - -##集成开发环境 - -IDE的全称是:Integrated Development Environment,简称IDE,也称为Integration Design Environment、Integration Debugging Environment,翻译成中文叫做“集成开发环境”,在台湾那边叫做“整合開發環境”。它是一种辅助程序员开发用的应用软。 - -[维基百科](http://zh.wikipedia.org/zh/%E9%9B%86%E6%88%90%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83)这样对IDE定义: - ->>IDE通常包括程式語言編輯器、自動建立工具、通常還包括除錯器。有些IDE包含編譯器/直譯器,如微软的Microsoft Visual Studio,有些则不包含,如Eclipse、SharpDevelop等,这些IDE是通过调用第三方编译器来实现代码的编译工作的。有時IDE還會包含版本控制系統和一些可以設計圖形用戶界面的工具。許多支援物件導向的現代化IDE還包括了類別瀏覽器、物件檢視器、物件結構圖。雖然目前有一些IDE支援多種程式語言(例如Eclipse、NetBeans、Microsoft Visual Studio),但是一般而言,IDE主要還是針對特定的程式語言而量身打造(例如Visual Basic)。 - -看不懂,没关系,看图,认识一下,混个脸熟就好了。所谓有图有真相。 - -![](./1images/10101.png) - -上面的图显示的是微软的提供的名字叫做Microsoft Visual Studio的IDE。用C#进行编程的程序员都用它。 - -![](./1images/10102.png) - -上图是在苹果电脑中出现的名叫XCode的IDE。 - -要想了解更多IDE的信息,推荐阅读维基百科中的词条 - -- 英文词条:[Integrated development environment](http://en.wikipedia.org/wiki/Integrated_development_environment) -- 中文词条:[集成开发环境](http://zh.wikipedia.org/zh/%E9%9B%86%E6%88%90%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83) - -##Python的IDE - -google一下:python IDE,会发现,能够进行python编程的IDE还真的不少。东西一多,就开始无所适从了。所有,有不少人都问用哪个IDE好。可以看看[这个提问,还列出了众多IDE的比较](http://stackoverflow.com/questions/81584/what-ide-to-use-for-python)。 - ->顺便向列位看客推荐一个非常好的开发相关网站:[stackoverflow.com](http://stackoverflow.com/) - ->在这里可以提问,可以查看答案。一般如果有问题,先在这里查找,多能找到非常满意的结果,至少有很大启发。 - ->在某国有时候有地方可能不能访问,需要科学上网。好东西,一定不会让你容易得到,也不会让任何人都得到。 - -那么做为零基础的学习者,用什么好呢? - -既然是零基础,就别瞎折腾了,就用Python自带的IDLE。原因就是:简单。 - -Windows的朋友操作:“开始”菜单->“所有程序”->“Python 2.x”->“IDLE(Python GUI)”来启动IDLE。启动之后,大概看到这样一个图 - -![](./1images/10203.png) - -注意:看官所看到的界面中显示版本跟这个图不同,因为安装的版本区别。大致模样差不多。 - -其它操作系统的用户,也都能在找到idle这个程序,启动之后,跟上面一样的图。 - -后面我们所有的编程,就在这里完成了。这就是伟大程序员用的第一个IDE。 - -除了这个自带的IDE,还有很多其它的IDE,列出来,供喜欢折腾的朋友参考 - -- PythonWin: 是Python Win32 Extensions(半官方性质的python for win32增强包)的一部分,也包含在ActivePython的windows发行版中。如其名字所言,只针对win32平台。 -- MacPython IDE: MacPythonIDE是Python的Mac OS发行版内置的IDE,可以看作是PythonWin的Mac对应版本,由Guido的哥哥Just van Rossum编写。(哥俩都很牛) -- Emacs和Vim: Emacs和Vim号称是这个星球上最强大(以及第二强大)的文本编辑器,对于许多程序员来说是万能IDE的不二(三?)选择。 -- Eclipse + PyDev: Eclipse是新一代的优秀泛用型IDE,虽然是基于Java技术开发的,但出色的架构使其具有不逊于Emacs和Vim的可扩展性,现在已经成为了许多程序员最爱的瑞士军刀。 - -简单列几个,供参考,要找别的IDE,网上搜一下,五花八门,不少呢。 - -磨刀不误砍柴工。IDE已经有了,伟大程序员就要开始从事伟大的编程工作了。 - ------- - -[总目录](./index.md)   |[   下节](./102.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 diff --git a/102.md b/102.md deleted file mode 100644 index c12d528..0000000 --- a/102.md +++ /dev/null @@ -1,154 +0,0 @@ ->For I am not ashamed of the gospel; it is the power of God for salvation to everyone who has faith, to the Jew first and also to the Greek. For in it the righteousness of God is revealed through faith for faith; s it is written,"The one who is righteous will live by faith" - -#数和四则运算 - -一提到计算机,当然现在更多人把她叫做电脑,这两个词都是指computer。不管什么,只要提到她,普遍都会想到她能够比较快地做加减乘除,甚至乘方开方等。乃至于,有的人在口语中区分不开计算机和计算器。 - -有一篇名为[《计算机前世》](http://www.flickering.cn/%E5%85%AB%E5%8D%A6%E5%A4%A9%E5%9C%B0/2015/02/%E8%AE%A1%E7%AE%97%E6%9C%BA%E5%89%8D%E4%B8%96%E7%AF%87%EF%BC%88%E4%B8%80%EF%BC%8C%E5%A7%91%E5%A8%98%E8%AE%A1%E7%AE%97%E6%9C%BA%EF%BC%89/)的文章,这样讲到: - ->还是先来看看计算机(computer)这个词是怎么来的。 英文学得好的小伙伴看到这货,computer ->第一反应好像是:“compute-er”是吧,应该是个什么样的人就对了,就是啊,“做计算的人”。 ->叮咚!恭喜你答对了。 ->最先被命名为 computer 的确实是人。也就是说,电子计算机(与早期的机械计算机)被给予这个名字是因为他们执行的是此前被分配到人的工作。 “计算机”原来是工作岗位,它被用来定义一个工种,其任务是执行计算诸如导航表,潮汐图表,天文历书和行星的位置要求的重复计算。从事这个工作的人就是 computer,而且大多是女神! - -原文还附有如下图片: - -![](./1images/10201.jpg) - -所以,以后要用第三人称来称呼computer,请用she(她)。现在你明白为什么程序员中那么多“他”了吧,因为computer是“她”。 - -##数 - -在python中,对数的规定比较简单,基本在小学数学水平即可理解。 - -那么,做为零基础学习这,也就从计算小学数学题目开始吧。因为从这里开始,数学的基础知识列位肯定过关了。 - - >>> 3 - 3 - >>> 3333333333333333333333333333333333333333 - 3333333333333333333333333333333333333333L - >>> 3.222222 - 3.222222 - -上面显示的是在交互模式下,如果输入3,就显示了3,这样的数称为整数,这个称呼和小学数学一样。 - -如果输入一个比较打的数,第二个,那么多个3组成的一个整数,在python中称之为长整数。为了表示某个数是长整数,python会在其末尾显示一个L。其实,现在的python已经能够自动将输入的很大的整数视为长整数了。你不必在这方面进行区别。 - -第三个,在数学里面称为小数,这里你依然可以这么称呼,不过就像很多编程语言一样,习惯称之为“浮点数”。至于这个名称的由来,也是有点说道的,有兴趣可以google. - -上述举例中,可以说都是无符号(或者说是非负数),如果要表示负数,跟数学中的表示方法一样,前面填上负号即可。 - -值得注意的是,我们这里说的都是十进制的数。 - -除了十进制,还有二进制、八进制、十六进制都是在编程中可能用到的,当然用六十进制的时候就比较少了(其实时间记录方式就是典型的六十进制)。 - -##变量 - -仅仅写出3、4、5是远远不够的,在编程语言中,经常要用到“变量”和“数”(在python中严格来讲是对象)建立一个对应关系。例如: - - >>> x = 5 - >>> x - 5 - >>> x = 6 - >>> x - 6 - -在这个例子中,`x = 5`就是在变量(x)和数(5)之间建立了对应关系,接着又建立了x与6之间的对应关系。我们可以看到,x先“是”5,后来“是”6。 - -在python中,有这样一句话是非常重要的:**对象有类型,变量无类型**。怎么理解呢? - -首先,5、6都是整数,python中为它们取了一个名字,叫做“整数”类型的数据,或者说数据类型是整数,用int表示。 - -当我们在python中写入了5、6,computer姑娘就自动在她的内存中某个地方给我们建立这两个对象(对象的定义后面会将,这里你先用着,逐渐就明晰含义了),就好比建造了两个雕塑,一个是形状似5,一个形状似6,这就两个对象,这两个对象的类型就是int. - -那个x呢?就好比是一个标签,当`x = 5`时,就是将x这个标签拴在了5上了,通过这个x,就顺延看到了5,于是在交互模式中,`>>> x`输出的结果就是5,给人的感觉似乎是x就是5,事实是x这个标签贴在5上面。同样的道理,当`x = 6`时,标签就换位置了,贴到6上面。 - -所以,这个标签x没有类型只说,它不仅可以贴在整数类型的对象上,还能贴在其它类型的对象上,比如后面会介绍到的str(字符串)类型的对象等等。 - -这是python区别于一些语言非常重要的地方。 - -##四则运算 - -按照下面要求,在交互模式中运行,看看得到的结果和用小学数学知识运算之后得到的结果是否一致 - - >>> 2+5 - 7 - >>> 5-2 - 3 - >>> 10/2 - 5 - >>> 5*2 - 10 - >>> 10/5+1 - 3 - >>> 2*3-4 - 2 - -上面的运算中,分别涉及到了四个运算符号:加(+)、减(-)、乘(*)、除(/) - -另外,我相信看官已经发现了一个重要的公理: - -**在计算机中,四则运算和小学数学中学习过的四则运算规则是一样的** - -要不说人是高等动物呢,自己发明的东西,一定要继承自己已经掌握的知识,别跟自己的历史过不去。伟大的科学家们,在当初设计计算机的时候就想到列位现在学习的需要了,一定不能让后世子孙再学新的运算规则,就用小学数学里面的好了。感谢那些科学家先驱者,泽被后世。 - -下面计算三个算术题,看看结果是什么 - -- 4 + 2 -- 4.0 + 2 -- 4.0 + 2.0 - -看官可能愤怒了,这么简单的题目,就不要劳驾计算机了,太浪费了。 - -别着急,还是要运算一下,然后看看结果,有没有不一样?要仔细观察哦。 - - >>> 4+2 - 6 - >>> 4.0+2 - 6.0 - >>> 4.0+2.0 - 6.0 - -不一样的地方是:第一个式子结果是6,这是一个整数;后面两个是6.0,这是浮点数。 - ->定义1:类似4、-2、129486655、-988654、0这样形式的数,称之为整数 ->定义2:类似4.0、-2.0、2344.123、3.1415926这样形式的数,称之为浮点数 - -对这两个的定义,不用死记硬背,google一下。记住爱因斯坦说的那句话:书上有的我都不记忆(是这么的说?好像是,大概意思,反正我也不记忆)。后半句他没说,我补充一下:忘了就google。 - -似乎计算机做一些四则运算是不在话下的,但是,有一个问题请你务必注意:在数学中,整数是可以无限大的,但是在计算机中,整数不能无限大。为什么呢?(我推荐你去google,其实计算机的基本知识中肯定学习过了。)因此,就会有某种情况出现,就是参与运算的数或者运算结果超过了计算机中最大的数了,这种问题称之为“整数溢出问题”。 - -##整数溢出问题 - -这里有一篇专门讨论这个问题的文章,推荐阅读:[整数溢出](http://zhaoweizhuanshuo.blog.163.com/blog/static/148055262201093151439742/) - -对于其它语言,整数溢出是必须正视的,但是,在python里面,看官就无忧愁了,原因就是python为我们解决了这个问题,请阅读拙文:[大整数相乘](https://github.com/qiwsir/algorithm/blob/master/big_int.md) - -ok!看官可以在IDE中实验一下大整数相乘。 - - >>> 123456789870987654321122343445567678890098876*1233455667789990099876543332387665443345566 - 152278477193527562870044352587576277277562328362032444339019158937017801601677976183816L - -看官是幸运的,python解忧愁,所以,选择学习python就是珍惜光阴了。 - -上面计算结果的数字最后有一个L,就表示这个数是一个长整数,不过,看官不用管这点,反正是python为我们搞定了。 - -在结束本节之前,有两个符号需要看官牢记(不记住也没关系,可以随时google,只不过记住后使用更方便) - -- 整数,用int表示,来自单词:integer -- 浮点数,用float表示,就是单词:float - -可以用一个命令:type(object)来检测一个数是什么类型。 - - >>> type(4) - #4是int,整数 - >>> type(5.0) -  #5.0是float,浮点数 - type(988776544222112233445566778899887766554433221133344455566677788998776543222344556678) - #是长整数,也是一个整数 - ------- - -[总目录](./index.md)   |   [上节:集成开发环境](./101.md)   |   [下节:除法](./103.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 diff --git a/103.md b/103.md deleted file mode 100644 index ed9518d..0000000 --- a/103.md +++ /dev/null @@ -1,183 +0,0 @@ ->"I give you a new commandment, that you love one another. Just as I have loved you, you also should love one another. By this everyone will know that you are my disciples, if you have love for one another."(JOHN14:34-35) - -#除法 - -除法啰嗦,不仅是python。 - -##整数除以整数 - -进入python交互模式之后(以后在本教程中,可能不再重复这类的叙述,只要看到>>>,就说明是在交互模式下),练习下面的运算: - - >>> 2 / 5 - 0 - >>> 2.0 / 5 - 0.4 - >>> 2 / 5.0 - 0.4 - >>> 2.0 / 5.0 - 0.4 - -看到没有?麻烦出来了(这是在python2.x中),按照数学运算,以上四个运算结果都应该是0.4。但我们看到的后三个符合,第一个居然结果是0。why? - -因为,在python(严格说是python2.x中,python3会有所变化)里面有一个规定,像2/5中的除法这样,是要取整(就是去掉小数,但不是四舍五入)。2除以5,商是0(整数),余数是2(整数)。那么如果用这种形式:2/5,计算结果就是商那个整数。或者可以理解为:**整数除以整数,结果是整数(商)**。 - -比如: - - >>> 5 / 2 - 2 - >>> 7 / 2 - 3 - >>> 8 / 2 - 4 - -**注意:**得到是商(整数),而不是得到含有小数位的结果再通过“四舍五入”取整。例如:5/2,得到的是商2,余数1,最终`5 / 2 = 2`。并不是对2.5进行四舍五入。 - -##浮点数与整数相除 - -这个标题和上面的标题格式不一样,上面的标题是“整数除以整数”,如果按照风格一贯制的要求,本节标题应该是“浮点数除以整数”,但没有,现在是“浮点数与整数相除”,其含义是: - ->假设:x除以y。其中 x 可能是整数,也可能是浮点数;y可能是整数,也可能是浮点数。 - -出结论之前,还是先做实验: - - >>> 9.0 / 2 - 4.5 - >>> 9 / 2.0 - 4.5 - >>> 9.0 / 2.0 - 4.5 - - >>> 8.0 / 2 - 4.0 - >>> 8 / 2.0 - 4.0 - >>> 8.0 / 2.0 - 4.0 - -归纳,得到规律:**不管是被除数还是除数,只要有一个数是浮点数,结果就是浮点数。**所以,如果相除的结果有余数,也不会像前面一样了,而是要返回一个浮点数,这就跟在数学上学习的结果一样了。 - - >>> 10.0 / 3 - 3.3333333333333335 - -这个是不是就有点搞怪了,按照数学知识,应该是3.33333...,后面是3的循环了。那么你的计算机就停不下来了,满屏都是3。为了避免这个,python武断终结了循环,但是,可悲的是没有按照“四舍五入”的原则终止。当然,还会有更奇葩的出现: - - >>> 0.1 + 0.2 - 0.30000000000000004 - >>> 0.1 + 0.1 - 0.2 - 0.0 - >>> 0.1 + 0.1 + 0.1 - 0.3 - 5.551115123125783e-17 - >>> 0.1 + 0.1 + 0.1 - 0.2 - 0.10000000000000003 - -越来越糊涂了,为什么computer姑娘在计算这么简单的问题上,如此糊涂了呢?不是computer姑娘糊涂,她依然冰雪聪明。原因在于十进制和二进制的转换上,computer姑娘用的是二进制进行计算,上面的例子中,我们输入的是十进制,她就要把十进制的数转化为二进制,然后再计算。但是,在转化中,浮点数转化为二进制,就出问题了。 - -例如十进制的0.1,转化为二进制是:0.0001100110011001100110011001100110011001100110011... - -也就是说,转化为二进制后,不会精确等于十进制的0.1。同时,计算机存储的位数是有限制的,所以,就出现上述现象了。 - -这种问题不仅仅是python中有,所有支持浮点数运算的编程语言都会遇到,它不是python的bug。 - -明白了问题原因,怎么解决呢?就python的浮点数运算而言,大多数机器上每次计算误差不超过 2**53 分之一。对于大多数任务这已经足够了,但是要在心中记住这不是十进制算法,每个浮点数计算可能会带来一个新的舍入错误。 - -一般情况下,只要简单地将最终显示的结果用“四舍五入”到所期望的十进制位数,就会得到期望的最终结果。 - -对于需要非常精确的情况,可以使用 decimal 模块,它实现的十进制运算适合会计方面的应用和高精度要求的应用。另外 fractions 模块支持另外一种形式的运算,它实现的运算基于有理数(因此像1/3这样的数字可以精确地表示)。最高要求则可是使用由 SciPy提供的 Numerical Python 包和其它用于数学和统计学的包。列出这些东西,仅仅是让看官能明白,解决问题的方式很多,后面会用这些中的某些方式解决上述问题。 - -关于无限循环小数问题,我有一个链接推荐给诸位,它不是想象的那么简单呀。请阅读:[维基百科的词条:0.999...](http://zh.wikipedia.org/wiki/0.999%E2%80%A6),会不会有深入体会呢? - ->补充一个资料,供有兴趣的朋友阅读:[浮点数算法:争议和限制](https://docs.python.org/2/tutorial/floatingpoint.html#tut-fp-issues) - -python总会要提供多种解决问题的方案的,这是她的风格。 - -##引用模块解决除法--启用轮子 - -python之所以受人欢迎,一个很重重要的原因,就是轮子多。这是比喻啦。就好比你要跑的快,怎么办?光天天练习跑步是不行滴,要用轮子。找辆自行车,就快了很多。还嫌不够快,再换电瓶车,再换汽车,再换高铁...反正你可以选择的很多。但是,这些让你跑的快的东西,多数不是你自己造的,是别人造好了,你来用。甚至两条腿也是感谢父母恩赐。正是因为轮子多,可以选择的多,就可以以各种不同速度享受了。 - -轮子是人类伟大的发明。 - -python就是这样,有各种轮子,我们只需要用。只不过那些轮子在python里面的名字不叫自行车、汽车,叫做“模块”,有人承接别的语言的名称,叫做“类库”、“类”。不管叫什么名字吧。就是别人造好的东西我们拿过来使用。 - -怎么用?可以通过两种形式用: - -- 形式1:import module-name。import后面跟空格,然后是模块名称,例如:import os -- 形式2:from module1 import module11。module1是一个大模块,里面还有子模块module11,只想用module11,就这么写了。 - -不啰嗦了,实验一个: - - >>> from __future__ import division - >>> 5 / 2 - 2.5 - >>> 9 / 2 - 4.5 - >>> 9.0 / 2 - 4.5 - >>> 9 / 2.0 - 4.5 - -注意了,引用了一个模块之后,再做除法,就不管什么情况,都是得到浮点数的结果了。 - -这就是轮子的力量。 - -##余数 - -前面计算5/2的时候,商是2,余数是1 - -余数怎么得到?在python中(其实大多数语言也都是),用`%`符号来取得两个数相除的余数. - -实验下面的操作: - - >>> 5 % 2 - 1 - >>> 6%4 - 2 - >>> 5.0%2 - 1.0 - -符号:%,就是要得到两个数(可以是整数,也可以是浮点数)相除的余数。 - -前面说python有很多人见人爱的轮子(模块),她还有丰富的内建函数,也会帮我们做不少事情。例如函数`divmod()` - - >>> divmod(5,2) #表示5除以2,返回了商和余数 - (2, 1) - >>> divmod(9,2) - (4, 1) - >>> divmod(5.0,2) - (2.0, 1.0) - -##四舍五入 - -最后一个了,一定要坚持,今天的确有点啰嗦了。要实现四舍五入,很简单,就是内建函数:`round()` - -动手试试: - - >>> round(1.234567,2) - 1.23 - >>> round(1.234567,3) - 1.235 - >>> round(10.0/3,4) - 3.3333 - -简单吧。越简单的时候,越要小心,当你遇到下面的情况,就有点怀疑了: - - >>> round(1.2345,3) - 1.234 #应该是:1.235 - >>> round(2.235,2) - 2.23 #应该是:2.24 - -哈哈,我发现了python的一个bug,太激动了。 - -别那么激动,如果真的是bug,这么明显,是轮不到我的。为什么?具体解释看这里,下面摘录官方文档中的一段话: - ->**Note:** ->The behavior of round() for floats can be surprising: for example, round(2.675, 2) gives 2.67 instead of the expected 2.68. This is not a bug: it’s a result of the fact that most decimal fractions can’t be represented exactly as a float. See [Floating Point Arithmetic: Issues and Limitations](https://docs.python.org/2/tutorial/floatingpoint.html#tut-fp-issues) for more information. - -原来真的轮不到我。归根到底还是浮点数中的十进制转化为二进制惹的祸。 - -似乎除法的问题到此要结束了,其实远远没有,不过,做为初学者,至此即可。还留下了很多话题,比如如何处理循环小数问题,我肯定不会让有探索精神的朋友失望的,在我的github中有这样一个轮子,如果要深入研究,[可以来这里尝试](https://github.com/qiwsir/algorithm/blob/master/divide.py)。 - ------- - -[总目录](./index.md)   |   [上节:数和四则运算](./102.md)   |   [下节:Math模块和运算优先级](./104.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/104.md b/104.md deleted file mode 100644 index 7280aa3..0000000 --- a/104.md +++ /dev/null @@ -1,168 +0,0 @@ ->He has told you, O mortal, what is good; ->and what does the LORD require of you ->but to do justice, and to love kindness, ->and to walk humbly with your God?(MICAH 6:8) - ->世人哪,耶和华已指示你何为善, ->他向你所要的是什么呢? ->只要你行公义,好怜悯, ->存谦卑的心,与你的神同行。 - -#常用数学函数和运算优先级 - -在数学之中,除了加减乘除四则运算之外——这是小学数学——还有其它更多的运算,比如乘方、开方、对数运算等等,要实现这些运算,需要用到python中的一个模块:Math - ->模块(module)是python中非常重要的东西,你可以把它理解为python的扩展工具。换言之,python默认情况下提供了一些可用的东西,但是这些默认情况下提供的还远远不能满足编程实践的需要,于是就有人专门制作了另外一些工具。这些工具被称之为“模块” ->任何一个pythoner都可以编写模块,并且把这些模块放到网上供他人来使用。 ->当安装好python之后,就有一些模块默认安装了,这个称之为“标准库”,“标准库”中的模块不需要安装,就可以直接使用。 ->如果没有纳入标准库的模块,需要安装之后才能使用。模块的安装方法,我特别推荐使用pip来安装。这里仅仅提一下,后面会专门进行讲述,性急的看官可以自己google。 - -##使用math模块 - -math模块是标准库中的,所以不用安装,可以直接使用。使用方法是: - - >>> import math - -用import就将math模块引用过来了,下面就可以使用这个模块提供的工具了。比如,要得到圆周率: - - >>> math.pi - 3.141592653589793 - -这个模块都能做哪些事情呢?可以用下面的方法看到: - - >>> dir(math) - ['__doc__', '__name__', '__package__', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceil', 'copysign', 'cos', 'cosh', 'degrees', 'e', 'erf', 'erfc', 'exp', 'expm1', 'fabs', 'factorial', 'floor', 'fmod', 'frexp', 'fsum', 'gamma', 'hypot', 'isinf', 'isnan', 'ldexp', 'lgamma', 'log', 'log10', 'log1p', 'modf', 'pi', 'pow', 'radians', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc'] - -`dir(module)`是一个非常有用的指令,可以通过它查看任何模块中所包含的工具。从上面的列表中就可以看出,在math模块中,可以计算正sin(a),cos(a),sqrt(a)...... - -这些我们称之为函数,也就是在模块math中提供了各类计算的函数,比如计算乘方,可以使用pow函数。但是,怎么用呢? - -python是一个非常周到的姑娘,她早就提供了一个命令,让我们来查看每个函数的使用方法。 - - >>> help(math.pow) - -在交互模式下输入上面的指令,然后回车,看到下面的信息: - - Help on built-in function pow in module math: - - pow(...) - pow(x, y) - - Return x**y (x to the power of y). - -这里展示了math模块中的pow函数的使用方法和相关说明。 - -1. 第一行意思是说这里是math模块的内建函数pow帮助信息(所谓built-in,称之为内建函数,是说这个函数是python默认就有的) -2. 第三行,表示这个函数的参数,有两个,也是函数的调用方式 -3. 第四行,是对函数的说明,返回`x**y`的结果,并且在后面解释了`x**y`的含义。 -4. 最后,按q键返回到python交互模式 - -从上面看到了一个额外的信息,就是pow函数和`x**y`是等效的,都是计算x的y次方。 - - >>> 4**2 - 16 - >>> math.pow(4,2) - 16.0 - >>> 4*2 - 8 - -特别注意,`4**2`和`4*2`是有很大区别的。 - -用类似的方法,可以查看math模块中的任何一个函数的使用方法。 - ->关于“函数”的问题,在这里不做深入阐述,看管姑且按照自己在数学中所学到去理解。后面会有专门研究函数的章节。 - -下面是几个常用的math模块中函数举例,看官可以结合自己调试的进行比照。 - - >>> math.sqrt(9) - 3.0 - >>> math.floor(3.14) - 3.0 - >>> math.floor(3.92) - 3.0 - >>> math.fabs(-2) #等价于abs(-2) - 2.0 - >>> abs(-2) - 2 - >>> math.fmod(5,3) #等价于5%3 - 2.0 - >>> 5%3 - 2 - -##几个常见函数 - -有几个常用的函数,列一下,如果记不住也不要紧,知道有这些就好了,用的时候就google。 - -**求绝对值** - - >>> abs(10) - 10 - >>> abs(-10) - 10 - >>> abs(-1.2) - 1.2 - -**四舍五入** - - >>> round(1.234) - 1.0 - >>> round(1.234,2) - 1.23 - - >>> #如果不清楚这个函数的用法,可以使用下面方法看帮助信息 - >>> help(round) - - Help on built-in function round in module __builtin__: - - round(...) - round(number[, ndigits]) -> floating point number - - Round a number to a given precision in decimal digits (default 0 digits). - This always returns a floating point number. Precision may be negative. - - -##运算优先级 - -从小学数学开始,就研究运算优先级的问题,比如四则运算中“先乘除,后加减”,说明乘法、除法的优先级要高于加减。 - -对于同一级别的,就按照“从左到右”的顺序进行计算。 - -下面的表格中列出了python中的各种运算的优先级顺序。不过,就一般情况而言,不需要记忆,完全可以按照数学中的去理解,因为人类既然已经发明了数学,在计算机中进行的运算就不需要从新编写一套新规范了,只需要符合数学中的即可。 - -|运算符|描述| -|------|----| -|lambda|Lambda表达式| -|or|布尔“或”| -|and|布尔“与”| -|not x|布尔“非”| -|in,not in|成员测试| -|is,is not|同一性测试| -|<,<=,>,>=,!=,==|比较| -|\||按位或| -|^|按位异或| -|&|按位与| -|<<,>>|移位| -|+,-|加法与减法| -|*,/,%|乘法、除法与取余| -|+x,-x|正负号| -|~x|按位翻转| -|**|指数| -|x.attribute|属性参考| -|x[index]|下标| -|x[index:index]|寻址段| -|f(arguments...)|函数调用| -|(experession,...)|绑定或元组显示| -|[expression,...]|列表显示| -|{key:datum,...}|字典显示| -|'expression,...'|字符串转换| - -上面的表格将python中用到的与运算符有关的都列出来了,是按照**从低到高**的顺序列出的。虽然有很多还不知道是怎么回事,不过先列出来,等以后用到了,还可以回来查看。 - -最后,要提及的是运算中的绝杀:括号。只要有括号,就先计算括号里面的。这是数学中的共识,无需解释。 - ------- - -[总目录](./index.md)   |   [上节:除法](./103.md)   |   [下节:写一个简单的程序](./105.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 - diff --git a/105.md b/105.md deleted file mode 100644 index 7387765..0000000 --- a/105.md +++ /dev/null @@ -1,165 +0,0 @@ ->You are the light of the world. A city located on a hill cannot be hidden. People do not light a lamp and put it under a basket but on a lampstand, and it gives light to all in the house. In te same way, let your light shine before people, so that they can see your good deeds and give honor to your Father in heaven.(Matthew 5:14-16) - ->你们是世上的光。城造在山上,是不能隐藏的。人点灯,不放在斗底下,是放在灯台上,就照亮一家的人。你们的光也当这样照在人前,叫他们看见你们的好行为,便将荣耀归给你们在天上的父。 - -#写一个简单的程序 - -通过对四则运算的学习,已经初步接触了Python中内容,如果看官是零基础的学习者,可能有点迷惑了。难道敲几个命令,然后看到结果,就算编程了?这也不是那些能够自动运行的程序呀? - -的确。到目前位置,还不能算编程,只能算会用一些指令(或者叫做命令)来做点简单的工作。 - -稍安勿躁,下面就开始编写一个真正的但是简单程序。 - -##程序 - -下面一段,关于程序的概念,内容来自维基百科: - -- 先阅读一段英文的:[computer program and source code](http://en.wikipedia.org/wiki/Computer_program),看不懂不要紧,可以跳过去,直接看下一条。 - ->A computer program, or just a program, is a sequence of instructions, written to perform a specified task with a computer.[1] A computer requires programs to function, typically executing the program's instructions in a central processor.[2] The program has an executable form that the computer can use directly to execute the instructions. The same program in its human-readable source code form, from which executable programs are derived (e.g., compiled), enables a programmer to study and develop its algorithms. A collection of computer programs and related data is referred to as the software. - ->Computer source code is typically written by computer programmers.[3] Source code is written in a programming language that usually follows one of two main paradigms: imperative or declarative programming. Source code may be converted into an executable file (sometimes called an executable program or a binary) by a compiler and later executed by a central processing unit. Alternatively, computer programs may be executed with the aid of an interpreter, or may be embedded directly into hardware. - ->Computer programs may be ranked along functional lines: system software and application software. Two or more computer programs may run simultaneously on one computer from the perspective of the user, this process being known as multitasking. - -- [计算机程序](http://zh.wikipedia.org/wiki/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%A8%8B%E5%BA%8F) - ->计算机程序(Computer Program)是指一组指示计算机或其他具有信息处理能力装置每一步动作的指令,通常用某种程序设计语言编写,运行于某种目标体系结构上。打个比方,一个程序就像一个用汉语(程序设计语言)写下的红烧肉菜谱(程序),用于指导懂汉语和烹饪手法的人(体系结构)来做这个菜。 - ->通常,计算机程序要经过编译和链接而成为一种人们不易看清而计算机可解读的格式,然后运行。未经编译就可运行的程序,通常称之为脚本程序(script)。 - -程序,简而言之,就是指令的集合。但是,有的程序需要编译,有的不需要。python编写的程序就不需要,因此她也被称之为解释性语言,编程出来的层序被叫做脚本程序。在有的程序员头脑中,有一种认为“编译型语言比解释性语言高价”的认识。这是错误的。不要认为编译的就好,不编译的就不好;也不要认为编译的就“高端”,不编译的就属于“低端”。有一些做了很多年程序的程序员或者其它什么人,可能会有这样的想法,这是毫无根据的。 - -不争论。用得妙就是好。 - -##用IDLE的编程环境 - -能够写python程序的工具很多,比如记事本就可以。当然,很多人总希望能用一个专门的编程工具,python里面自带了一个,作为简单应用是足够了。另外,可以根据自己的喜好用其它的工具,比如我用的是vim,有不少人也用eclipse,还有notepad++,等等。软件领域为编程提供了丰富多彩的工具。 - -以python默认的IDE为例,如下所示: - -操作:File->New window - -![](./1images/10501.png) - -这样,就出现了一个新的操作界面,在这个界面里面,看不到用于输入指令的提示符:>>>,这个界面有点像记事本。说对了,本质上就是一个记事本,只能输入文本,不能直接在里面贴图片。 - -![](./1images/10502.png) - -##写两个大字:Hello,World - -Hello,World.是面向世界的标志,所以,写任何程序,第一句一定要写这个,因为程序员是面向世界的,绝对不畏缩在某个局域网内,所以,所以看官要会科学上网,才能真正与世界Hello。 - -直接上代码,就这么一行即可。 - - print "Hello,World" - -如下图的样式 - -![](./1images/10503.png) - -前面说过了,程序就是指令的集合,现在,这个程序里面,就一条指令。一条指令也可以成为集合。 - -注意观察,菜单上有一个RUN,点击这个菜单,在下拉的里面选择Run Moudle - -![](./1images/10504.png) - -会弹出对话框,要求把这个文件保存,这就比较简单了,保存到一个位置,看官一定要记住这个位置,并且取个文件名,文件名是以.py为扩展名的。 - -都做好之后,点击确定按钮,就会发现在另外一个带有>>>的界面中,就自动出来了Hello,World两个大字。 - -成功了吗?成功了也别兴奋,因为还没有到庆祝的时候。 - -在这种情况系,我们依然是在IDLE的环境中实现了刚才那段程序的自动执行,如果脱离这个环境呢? - -下面就关闭IDLE,打开shell(如果看官在使用苹果的 Mac OS 操作系统或者某种linux发行版的操作系统,比如我使用的是ubuntu),或者打开cmd(windows操作系统的用户,特别提醒用windows的用户,使用windows不是你的错,错就错在你只会使用鼠标点来点去,而不想也不会使用命令,更不想也不会使用linux的命令,还梦想成为优秀程序员。),通过命令的方式,进入到你保存刚才的文件目录。 - -下图是我保存那个文件的地址,我把那个文件命名为105.py,并保存在一个文件夹中。 - -![](./1images/10505.png) - -然后在这个shell里面,输入:python 105.py - -上面这句话的含义就是告诉计算机,给我运行一个python语言编写的程序,那个程序文件的名称是105.py - -我的计算机我做主。于是它给我乖乖地执行了这条命令。如下图: - -![](./1images/10506.png) - -还在沉默?可以欢呼了,德国队7:1胜巴西对,列看官中,不管是德国队还是巴西队的粉丝,都可以欢呼,因为你在程序员道路上迈出了伟大的第二步(什么迈出的第一步?)。顺便预测一下,本届世界杯最终冠军应该是:中国队。(还有这么扯的吗?) - -##解一道题目 - -请计算:19+2*4-8/2 - -代码如下: - - #!/usr/bin/env python - #coding:utf-8 - - """ - 请计算: - 19+2*4-8/2 - """ - - a = 19+2*4-8/2 - print a - -提醒初学者,别复制这段代码,而是要一个字一个字的敲进去。然后保存(我保存的文件名是:105-1.py)。 - -在shell或者cmd中,执行:python (文件名.py) - -执行结果如下图: - -![](./1images/10507.png) - -好像还是比较简单。 - -下面对这个简单程序进行一一解释。 - - #!/usr/bin/env python - -这一行是必须写的,它能够引导程序找到python的解析器,也就是说,不管你这个文件保存在什么地方,这个程序都能执行,而不用制定python的安装路径。 - - #coding:utf-8 - -这一行是告诉python,本程序采用的编码格式是utf-8,什么是编码?什么是utf-8?这是一个比较复杂且有历史的问题,此处暂不讨论。只有有了上面这句话,后面的程序中才能写汉字,否则就会报错了。看官可以把你的程序中的这行删掉,看看什么结果? - - """ - 请计算: - 19+2*4-8/2 - """ -这一行是让人看的,计算机看不懂。在python程序中(别的编程语言也是如此),要写所谓的注释,就是对程序或者某段语句的说明文字,这些文字在计算机执行程序的时候,被计算机姑娘忽略,但是,注释又是必不可少的,正如前面说的那样,程序在大多数情况下是给人看的。注释就是帮助人理解程序的。 - -写注释的方式有两种,一种是单行注释,用`#`开头,另外一种是多行注释,用一对`'''`包裹起来。比如: - - """ - 请计算: - 19+2*4-8/2 - """ - -用`#`开头的注释,可以像下面这样来写: - - #请计算:19+2*4-8/2 - -这种注释通常写在程序中的某个位置,比如某个语句的前面或者后面。计算机也会忽略这种注释的内容,只是给人看的。以`#`开头的注释,会在后面的编程中大量使用。 - -一般在程序的开头部分,都要写点东西,主要是告诉别人这个程序是用来做什么的。 - - a = 19+2*4-8/2 - -所谓语句,就是告诉程序要做什么事情。程序就是有各种各样的语句组成的。这条语句,又有一个名字,叫做复制语句。`19+2*4-8/2`是一个表达式,最后要计算出一个结果,这个结果就是一个对象(又遇到了对象这个属于。在某些地方的方言中,把配偶、男女朋友也称之为对象,“对象”是一个应用很广泛的术语)。`=`不要理解为数学中的等号,它的作用不是等于,而是完成赋值语句中“赋值”的功能。`a`就是变量。这样就完成了一个赋值过程。 - ->语句和表达式的区别:“表达式就是某件事”,“语句是做某件事”。 - - print a - -这还是一个语句,称之为print语句,就是要打印出a的值(这种说法不是非常非常严格,但是通常总这么说。按照严格的说法,是打印变量a做对应的对象的值。嫌这种说法啰嗦,就直接说打印a的值)。 - -是不是在为看到自己写的第一个程序而欣慰呢? - ------- - -[总目录](./index.md)   |   [上节:常用数学函数和运算优先级](./104.md)   |   [下节:字符串(1)](./106.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/106.md b/106.md deleted file mode 100644 index e0d3b17..0000000 --- a/106.md +++ /dev/null @@ -1,250 +0,0 @@ ->And since they did not see fit to acknowledge God, God gave them up to a debased mind and things that should no be done. They were filled with every kind of wickedness, evil, covetousness, malice. Full of envy, murder, strife, deceit, craftiness, they are gossips, slanderers, God-haters, insolent, haughty, boastful, inventors of evil, rebellious toward parents, foolish,faithless, heartless, ruthless. They know God's decree, that those who practice such things deserve to die--yet they not only do them but even applaud others who practice them. (ROMANS 1:28-32) - -#字符串(1) - -如果对自然语言分类,有很多中分法,比如英语、法语、汉语等,这种分法是最常见的。在语言学里面,也有对语言的分类方法,比如什么什么语系之类的。我这里提出一种分法,这种分法尚未得到广大人民群众和研究者的广泛认同,但是,我相信那句“真理是掌握在少数人的手里”,至少在这里可以用来给自己壮壮胆。 - -我的分法:一种是语言中的两个元素(比如两个字)拼接在一起,出来一个新的元素(比如新的字);另外一种是两个元素拼接在一起,只是得到这两个元素的并列显示。比如“好”和“人”,两个元素拼接在一起是“好人”,而3和5拼接(就是整数求和)在一起是8,如果你认为是35,那就属于第二类了。 - -把我的这种分法抽象一下: - -- 一种是:△ +□ = ○ -- 另外一种是:△ +□ = △ □ - -我们的语言中,离不开以上两类,不是第一类就是第二类。 - -太天才了。请鼓掌。 - -##字符串 - -在我洋洋自得的时候,我google了一下,才发现,自己没那么高明,看[维基百科的字符串词条](http://zh.wikipedia.org/wiki/%E5%AD%97%E7%AC%A6%E4%B8%B2)是这么说的: - ->字符串(String),是由零个或多个字符组成的有限串行。一般记为s=a[1]a[2]...a[n]。 - -看到维基百科的伟大了吧,它已经把我所设想的一种情况取了一个形象的名称,叫做字符串,本质上就是一串字符。 - -根据这个定义,在前面两次让一个程序员感到伟大的"Hello,World",就是一个字符串。或者说不管用英文还是中文还是别的某种文,写出来的文字都可以做为字符串对待,当然,里面的特殊符号,也是可以做为字符串的,比如空格等。 - -严格地说,在python中的字符串是一种对象类型,这种类型用str表示,通常单引号`''`或者双引号`""`包裹起来。 - ->字符串和前面讲过的数字一样,都是对象的类型,或者说都是值。当然,表示方式还是有区别的。 - - >>> "I love Python." - 'I love Python.' - >>> 'I LOVE PYTHON.' - 'I LOVE PYTHON.' - -从这两个例子中可以看出来,不论使用单引号还是双引号,结果都是一样的。 - - >>> 250 - 250 - >>> type(250) - - - >>> "250" - '250' - >>> type("250") - - -仔细观察上面的区别,同样是250,一个没有放在引号里面,一个放在了引号里面,用`type()`函数来检验一下,发现它们居然是两种不同的对象类型,前者是int类型,后者则是str类型,即字符串类型。所以,请大家务必注意,不是所有数字都是int(or float),必须要看看,它在什么地方,如果在引号里面,就是字符串了。如果搞不清楚是什么类型,就让`type()`来帮忙搞定。 - -操练一下字符串吧。 - - >>> print "good good study, day day up" - good good study, day day up - >>> print "----good---study---day----up" - ----good---study---day----up - -在print后面,打印的都是字符串。注意,是双引号里面的,引号不是字符串的组成部分。它是在告诉计算机,它里面包裹着的是一个字符串。 - -爱思考的看官肯定发现上面这句话有问题了。如果我要把下面这句话看做一个字符串,应该怎么做? - - What's your name? - -这个问题非常好,因为在这句话中有一个单引号,如果直接在交互模式中像上面那样输入,就会这样: - - >>> 'What's your name?' - File "", line 1 - 'What's your name?' - ^ - SyntaxError: invalid syntax - -出现了`SyntaxError`(语法错误)引导的提示,这是在告诉我们这里存在错误,错误的类型就是`SyntaxError`,后面是对这种错误的解释“invalid syntax”(无效的语法)。特别注意,错误提示的上面,有一个^符号,直接只着一个单引号,不用多说,你也能猜测出,大概在告诉我们,可能是这里出现错误了。 - ->在python中,这一点是非常友好的,如果语句存在错误,就会将错误输出来,供程序员改正参考。当然,错误来源有时候比较复杂,需要根据经验和知识进行修改。还有一种修改错误的好办法,就是讲错误提示放到google中搜索。 - -上面那个值的错误原因是什么呢?仔细观察,发现那句话中事实上有三个单引号,本来一对单引号之间包裹的是一个字符串,现在出现了三个(一对半)单引号,computer姑娘迷茫了,她不知道单引号包裹的到底是谁。于是报错。 - -**解决方法一:**双引号包裹单引号 - - >>> "What's your name?" - "What's your name?" - -用双引号来包裹,双引号里面允许出现单引号。其实,反过来,单引号里面也可以包裹双引号。这个可以笼统地成为二者的嵌套。 - -**解决方法二:**使用转移符 - -所谓转移,就是让某个符号不在表示某个含义,而是表示另外一个含义。转义符的作用就是它能够别的符号转义。在python中,用`\`作为转义符(其实很多语言,只要有转义符的,都是用这个符号)。 - - >>> 'What\'s your name?' - "What's your name?" - -是不是看到转义符`\`的作用了。 - -本来单引号表示包括字符串,它不是字符串一部分,但是如果前面有转义符,那么它就失去了原来的含义,转化为字符串的一部分,相当于一个特殊字符了。 - -##变量和字符串 - -前面讲过**变量无类型,对象有类型**了,比如在数字中: - - >>> a = 5 - >>> a - 5 - -其本质含义是变量a相当于一个标签,贴在了对象5上面。并且我们把这个语句叫做赋值语句。 - -同样,在对字符串类型的对象,也是这样,能够通过赋值语句,将对象与某个标签(变量)关联起来。 - - >>> b = "hello,world" - >>> b - 'hello,world' - >>> print b - hello,world - -还记得我们曾经用过一个type命令吗?现在它还有用,就是检验一个变量,到底跟什么类型联系着,是字符串还是数字? - - >>> type(a) - - >>> type(b) - - -有时候,你会听到一种说法:把a称之为数字型变量,把b叫做字符(串)型变量。这种说法,在某些语言中是成立的。某些语言,需要提前声明变量,然后变量就成为了一个筐,将值装到这个筐里面。但是,python不是这样的。要注意区别。 - -##拼接字符串 - -还记得我在本节开篇提出的那个伟大发现吗?就是将两个东西拼接起来。 - -对数字,如果拼接,就是对两个数字求和。如:3+5,就计算出为8。那么对字符串都能进行什么样的操作呢?试试吧: - - >>> "py" + "thon" - 'python' - -跟我那个不为大多数人认可的发现是一样的,你还不认可吗?两个字符串相加,就相当于把两个字符串连接起来。(别的运算就别尝试了,没什么意义,肯定报错,不信就试试) - - >>> "py" - "thon" #这么做的人,是脑袋进水泥了吧? - Traceback (most recent call last): - File "", line 1, in - TypeError: unsupported operand type(s) for -: 'str' and 'str' - -用`+`号实现连接,的确比较简单,不过,有时候你会遇到这样的问题: - - >>> a = 1989 - >>> b = "free" - >>> print b+a - Traceback (most recent call last): - File "", line 1, in - TypeError: cannot concatenate 'str' and 'int' objects - ->这里引入了一个指令:`print`,意思就是打印后面的字符串(或者指向字符串的变量),上面是python2中的使用方式,在python3中,它变成了一个函数。应该用`print(b+a)`的样式了。 - -抱错了,其错误原因已经打印出来了(一定要注意看打印出来的信息):`cannot concatenate 'str' and 'int' objects`。原来`a`对应的对象是一个`int`类型的,不能将它和`str`对象连接起来。怎么办? - -原来,用`+`拼接起来的两个对象,必须是同一种类型的。如果两个都是数字,毫无疑问是正确的,就是求和;如果都是字符串,那么就得到一个新的字符串。 - -修改上面的错误,可以通过以下方法: - - >>> print b + `a` - free1989 - -注意,` ` 是反引号,不是单引号,就是键盘中通常在数字1左边的那个,在英文半角状态下输入的符号。这种方法,在编程实践中比较少应用,特别是在python3中,已经把这种方式弃绝了。我想原因就是这个符号太容易和单引号混淆了。在编程中,也不容易看出来,可读性太差。 - -常言道:“困难只有一个,解决困难的方法不止一种”,既然反引号可读性不好,在编程实践中就尽量不要使用。于是乎就有了下面的方法,这是被广泛采用的。不但简单,更主要是直白,一看就懂什么意思了。 - - >>> print b + str(a) - free1989 - -用`str(a)`实现将整数对象转换为字符串对象。虽然str是一种对象类型,但是它也能够实现对象类型的转换,这就起到了一个函数的作用。其实前面已经讲过的int也有类似的作用。比如: - - >>> a = "250" - >>> type(a) - - >>> b = int(a) - >>> b - 250 - >>> type(b) - - ->提醒列位,如果你对int和str比较好奇,可以在交互模式中,使用help(int),help(str)查阅相关的更多资料。 - -还有第三种: - - >>> print b + repr(a) #repr(a)与上面的类似 - free1989 - -这里repr()是一个函数,其实就是反引号的替代品,它能够把结果字符串转化为合法的python表达式。 - -可能看官看到这个,就要问它们三者之间的区别了。首先明确,repr()和``是一致的,就不用区别了。接下来需要区别的就是repr()和str,一个最简单的区别,repr是函数,str是跟int一样,一种对象类型。不过这么说是不能完全解惑的。幸亏有那好的google让我辈使用,你会找到不少人对这两者进行区分的内容,我推荐这个: - ->1. When should i use str() and when should i use repr() ? -> ->Almost always use str when creating output for end users. -> ->repr is mainly useful for debugging and exploring. For example, if you suspect a string has non printing characters in it, or a float has a small rounding error, repr will show you; str may not. -> ->repr can also be useful for for generating literals to paste into your source code. It can also be used for persistence (with ast.literal_eval or eval), but this is rarely a good idea--if you want editable persisted values, something like JSON or YAML is much better, and if you don't plan to edit them, use pickle. - ->2.In which cases i can use either of them ? -> ->Well, you can use them almost anywhere. You shouldn't generally use them except as described above. - ->3.What can str() do which repr() can't ? -> ->Give you output fit for end-user consumption--not always (e.g., str(['spam', 'eggs']) isn't likely to be anything you want to put in a GUI), but more often than repr. -> ->4.What can repr() do which str() can't -> ->Give you output that's useful for debugging--again, not always (the default for instances of user-created classes is rarely helpful), but whenever possible. -> ->And sometimes give you output that's a valid Python literal or other expression--but you rarely want to rely on that except for interactive exploration. - -以上英文内容来源:http://stackoverflow.com/questions/19331404/str-vs-repr-functions-in-python-2-7-5 - -##Python转义字符 - -在字符串中,有时需要输入一些特殊的符号,但是,某些符号不能直接输出,就需要用转义符。所谓转义,就是不采用符号现在之前的含义,而采用另外一含义了。下面表格中列出常用的转义符: - -|转义字符 | 描述 | -|----------|-------| -| \ | (在行尾时) 续行符 | -| \\ | 反斜杠符号 | -| \' | 单引号 | -| \" | 双引号 | -| \a | 响铃 | -| \b | 退格(Backspace) | -| \e | 转义 | -| \000 | 空 | -| \n | 换行 | -| \v | 纵向制表符 | -| \t | 横向制表符 | -| \r | 回车 | -| \f | 换页 | -| \oyy | 八进制数,yy代表的字符,例如:\o12代表换行| -| \xyy | 十六进制数,yy代表的字符,例如:\x0a代表换行| -| \other | 其它的字符以普通格式输出 | - -以上所有转义符,都可以通过交互模式下print来测试一下,感受实际上是什么样子的。例如: - - >>> print "hello.I am qiwsir.\ #这里换行,下一行接续 - ... My website is 'http://qiwsir.github.io'." - hello.I am qiwsir.My website is 'http://qiwsir.github.io'. - - >>> print "you can connect me by qq\\weibo\\gmail" #\\是为了要后面那个\ - you can connect me by qq\weibo\gmail - -看官自己试试吧。如果有问题,可以联系我解答。 - ------- - -[总目录](./index.md)   |   [上节:写一个简单的程序](./105.md)   |   [下节:字符串(2)](./107.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 diff --git a/107.md b/107.md deleted file mode 100644 index 1d140fa..0000000 --- a/107.md +++ /dev/null @@ -1,195 +0,0 @@ -#字符串(2) - -##raw_input和print - -自从本课程开始以来,我们还没有感受到computer姑娘的智能。最简单的智能应该体现在哪里呢?想想小孩子刚刚回说话的时候情景吧。 - ->小孩学说话,是一个模仿的过程,孩子周围的人怎么说,她(他)往往就是重复。看官可以忘记自己当初是怎么学说话了吧?就找个小孩子观察一下吧。最好是自己的孩子。如果没有,就要抓紧了。 - -通过python能不能实现这个简单的功能呢?当然能,要不然python如何横行天下呀。 - -不过在写这个功能前,要了解两个函数:raw_input和print - ->这两个都是python的内建函数(built-in function)。关于python的内建函数,下面这个表格都列出来了。所谓内建函数,就是能够在python中直接调用,不需要做其它的操作。 - -Built-in Functions - -------------------------------------------------------------- -|abs() | divmod() | input()| open()| staticmethod()| --------------------------------------------------------------- -|all() | enumerate() | int() | ord() | str()| --------------------------------------------------------------- -|any() | eval() | isinstance()| pow()| sum()| --------------------------------------------------------------- -|basestring() | execfile() | issubclass() | print() | super()| --------------------------------------------------------------- -|bin() | file() | iter()| property()| tuple()| --------------------------------------------------------------- -|bool() | filter() | len() | range() | type()| --------------------------------------------------------------- -|bytearray() | float()| list() | raw_input()| unichr()| --------------------------------------------------------------- -|callable() | format() | locals() | reduce() | unicode()| --------------------------------------------------------------- -|chr() | frozenset() | long() | reload() | vars()| --------------------------------------------------------------- -|classmethod()| getattr()| map() | repr() | xrange()| --------------------------------------------------------------- -|cmp() | globals()| max()| reversed()| zip()| --------------------------------------------------------------- -|compile() |hasattr() | memoryview()| round() | __import__()| --------------------------------------------------------------- -|complex() |hash() | min()| set() | apply()| --------------------------------------------------------------- -|delattr() |help()| next()| setattr()| buffer()| --------------------------------------------------------------- -|dict() | hex() |object() |slice() | coerce()| --------------------------------------------------------------- -|dir() | id() |oct() |sorted() |intern()| --------------------------------------------------------------- - -这些内建函数,怎么才能知道哪个函数怎么用,是干什么用的呢? - -不知道你是否还记得我在前面使用过的方法,这里再进行演示,这种方法是学习python的法宝。 - - >>> help(raw_input) - -然后就出现: - - Help on built-in function raw_input in module __builtin__: - - raw_input(...) - raw_input([prompt]) -> string - - Read a string from standard input. The trailing newline is stripped. - If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError. - On Unix, GNU readline is used if enabled. The prompt string, if given, - is printed without a trailing newline before reading. - -从中是不是已经清晰地看到了`raw_input()`的使用方法了。 - -还有第二种方法,那就是到python的官方网站,查看内建函数的说明。https://docs.python.org/2/library/functions.html - -其实,我上面那个表格,就是在这个网页中抄过来的。 - -例如,对`print()`说明如下: - - print(*objects, sep=' ', end='\n', file=sys.stdout) - - Print objects to the stream file, separated by sep and followed by end. sep, end and file, if present, must be given as keyword arguments. - - All non-keyword arguments are converted to strings like str() does and written to the stream, separated by sep and followed by end. Both sep and end must be strings; they can also be None, which means to use the default values. If no objects are given, print() will just write end. - - The file argument must be an object with a write(string) method; if it is not present or None, sys.stdout will be used. Output buffering is determined by file. Use file.flush() to ensure, for instance, immediate appearance on a screen. - -分别在交互模式下,将这个两个函数操练一下。 - - >>> raw_input("input your name:") - input your name:python - 'python' - -输入名字之后,就返回了输入的内容。用一个变量可以获得这个返回值。 - - >>> name = raw_input("input your name:") - input your name:python - >>> name - 'python' - >>> type(name) - - -而且,返回的结果是str类型。如果输入的是数字呢? - - >>> age = raw_input("How old are you?") - How old are you?10 - >>> age - '10' - >>> type(age) - - -返回的结果,仍然是str类型。 - -再试试`print()`,看前面对它的说明,是比较复杂的。没关系,我们从简单的开始。在交互模式下操作: - - >>> print("hello, world") - hello, world - >>> a = "python" - >>> b = "good" - >>> print a - python - >>> print a,b - python good - -比较简单吧。当然,这是没有搞太复杂了。 - -特别要提醒的是,`print()`默认是以`\n`结尾的,所以,会看到每个输出语句之后,输出内容后面自动带上了`\n`,于是就换行了。 - -有了以上两个准备,接下来就可以写一个能够“对话”的小程序了。 - - #!/usr/bin/env python - # coding=utf-8 - - name = raw_input("What is your name?") - age = raw_input("How old are you?") - - print "Your name is:", name - print "You are " + age + " years old." - - after_ten = int(age) + 10 - print "You will be " + str(after_ten) + " years old after ten years." - -对这段小程序中,有几点说明 - -前面演示了`print()`的使用,除了打印一个字符串之外,还可以打印字符串拼接结果。 - - print "You are " + age + " years old." - -注意,那个变量`age`必须是字符串,如最后的那个语句中: - - print "You will be " + str(after_ten) + " years old after ten years." - -这句话里面,有一个类型转化,将原本是整数型`after_ten`转化为了str类型。否则,就包括,不信,你可以试试。 - -同样注意,在`after_ten = int(age) + 10`中,因为通过`raw_input`得到的是str类型,当age和10求和的时候,需要先用`int()`函数进行类型转化,才能和后面的整数10相加。 - -这个小程序,是有点综合的,基本上把已经学到的东西综合运用了一次。请看官调试一下,如果没有通过,仔细看报错信息,你能够从中获得修改方向的信息。 - -##原始字符串 - -所谓原始字符串,就是指字符串里面的每个字符都是原始含义,比如反斜杠,不会被看做转义符。如果在一般字符串中,比如 - - >>> print "I like \npython" - I like - python - -这里的反斜杠就不是“反斜杠”的原始符号含义,而是和后面的n一起表示换行(转义了)。当然,这似乎没有什么太大影响,但有的时候,可能会出现问题,比如打印DOS路径(DOS,有没有搞错,现在还有人用吗?) - - >>> dos = "c:\news" - >>> dos - 'c:\news' #这里貌似没有什么问题 - >>> print dos #当用print来打印这个字符串的时候,就出问题了。 - c: - ews - -如何避免?用前面讲过的转义符可以解决: - - >>> dos = "c:\\news" - >>> print dos - c:\news - -此外,还有一种方法,如: - - >>> dos = r"c:\news" - >>> print dos - c:\news - >>> print r"c:\news\python" - c:\news\python - -状如`r"c:\news"`,由r开头引起的字符串,就是原始字符串,在里面放任何字符都表示该字符的原始含义。 - -这种方法在做网站设置网站目录结构的时候非常有用。使用了原始字符串,就不需要转义了。 - ------- - -[总目录](./index.md)   |   [上节:字符串(1)](./106.md)   |   [下节:字符串(3)](./108.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 - diff --git a/108.md b/108.md deleted file mode 100644 index cfd1d86..0000000 --- a/108.md +++ /dev/null @@ -1,234 +0,0 @@ ->你们又听见有吩咐古人的话,说:“不可背誓,所起的誓,总要向主谨守”。只是我告诉你们,什么誓都不可起,不可指着天起誓,因为天是神的座位。不可指着地起誓,因为地是他的脚蹬,也不可指着耶路撒冷起誓,因为耶路撒冷是大君的京城。又不可指着你的头起誓,因为你不能使一根头发变黑变白了。你的话,是,就说是。不是,就说不是。若再多说,就是出于那恶者。(Matthew 5:33-37) - -#字符串(3) - -关于字符串的内容,已经有两节进行介绍了。不过,它是一个话题中心,还要再继续。 - -例如这样一个字符串`python`,还记得前面对字符串的定义吗?它就是几个字符:p,y,t,h,o,n,排列起来。这种排列是非常严格的,不仅仅是字符本身,而且还有顺序,换言之,如果某个字符换了,就编程一个新字符串了;如果这些字符顺序发生变化了,也成为了一个新字符串。 - -在python中,把像字符串这样的对象类型(后面还会冒出来类似的其它有这种特点的对象类型,比如列表),统称为序列。顾名思义,序列就是“有序排列”。 - -比如水泊梁山的108个好汉(里面分明也有女的,难道女汉子是从这里来的吗?),就是一个“有序排列”的序列。从老大宋江一直排到第108位金毛犬段景。在这个序列中,每个人有编号,编号和每个人一一对应。1号是宋江,2号是卢俊义。反过来,通过每个人的姓名,也能找出他对应的编号。武松是多少号?14号。李逵呢?22号。 - -在python中,给这些编号取了一个文雅的名字,叫做**索引**(别的编程语言也这么称呼,不是python独有的。)。 - -##索引和切片 - -前面用梁山好汉的为例说明了索引。再看python中的例子: - - >>> lang = "study python" - >>> lang[0] - 's' - >>> lang[1] - 't' - -有一个字符串,通过赋值语句赋给了变量lang。如果要得到这个字符串的第一个单词`s`,可以用`lang[0]`。当然,如果你不愿意通过赋值语句,让变量lang来指向那个字符串,也可以这样做: - - >>> "study python"[0] - 's' - -效果是一样的。因为lang是标签,就指向了`"study python"`字符串。当让python执行`lang[0]`的时候,就是要转到那个字符串对象,如同上面的操作一样。只不过,如果不用lang这么一个变量,后面如果再写,就费笔墨了,要每次都把那个字符串写全了。为了省事,还是复制给一个变量吧。变量就是字符串的代表了。 - -字符串这个序列的排序方法跟梁山好汉有点不同,第一个不是用数字1表示,而是用数字0表示。不仅仅python,其它很多语言都是从0开始排序的。为什么这样做呢?这就是规定。当然,这个规定是有一定优势的。此处不展开,有兴趣的网上去google一下,有专门对此进行解释的文章。 - -0 |1 |2 |3 |4 |5 |6 |7 |8 |9 |10 |11 ----|---|---|---|---|---|---|---|---|---|---|--- -s |t |u |d |y | |p |y |t |h |o |n - -上面的表格中,将这个字符串从第一个到最后一个进行了排序,特别注意,两个单词中间的那个空格,也占用了一个位置。 - -通过索引能够找到该索引所对应的字符,那么反过来,能不能通过字符,找到其在字符串中的索引值呢?怎么找? - - >>> lang.index("p") - 6 - -就这样,是不是已经能够和梁山好汉的例子对上号了?只不过区别在于第一个的索引值是0。 - -如果某一天,宋大哥站在大石头上,向着各位弟兄大喊:“兄弟们,都排好队。”等兄弟们排好之后,宋江说:“现在给各位没有老婆的兄弟分配女朋友,我这里已经有了名单,我念叨的兄弟站出来。不过我是按照序号来念的。第29号到第34号先出列,到旁边房子等候分配女朋友。” - -在前面的例子中lang[1]能够得到原来字符串的第二个字符t,就相当于从原来字符串中把这个“切”出来了。不过,我们这么“切”却不影响原来字符串的完整性,当然可以理解为将那个字符t赋值一份拿出来了。 - -那么宋江大哥没有一个一个“切”,而是一下将几个兄弟叫出来。在python中也能做类似事情。 - - >>> lang - 'study python' #在前面“切”了若干的字符之后,再看一下该字符串,还是完整的。 - >>> lang[2:9] - 'udy pyt' - -通过`lang[2:9]`要得到部分(不是一个)字符,从返回的结果中可以看出,我们得到的是序号分别对应着`2,3,4,5,6,7,8`(跟上面的表格对应一下)字符(包括那个空格)。也就是,这种获得部分字符的方法中,能够得到开始需要的以及最后一个序号之前的所对应的字符。有点拗口,自己对照上面的表格数一数就知道了。简单说就是包括开头,不包括结尾。 - -上述,不管是得到一个还是多个,通过索引得到字符的过程,称之为**切片**。 - -切片是一个很有意思的东西。可以“切”出不少花样呢? - - >>> lang - 'study python' - >>> b = lang[1:] #得到从1号到最末尾的字符,这时最后那个需要不用写 - >>> b - 'tudy python' - >>> c = lang[:] #得到所有字符 - >>> c - 'study python' - >>> d = lang[:10] #得到从第一个到10号之前的字符 - >>> d - 'study pyth' - -在获取切片的时候,如果分号的前面或者后面的序号不写,就表示是到最末(后面的不写)或第一个(前面的不写) - -`lang[:10]`的效果和`lang[0:10]`是一样的。 - - >>> e = lang[0:10] - >>> e - 'study pyth' - -那么,`lang[1:]`和`lang[1:11]`效果一样吗?请思考后作答。 - - >>> lang[1:11] - 'tudy pytho' - >>> lang[1:] - 'tudy python' - -果然不一样,你思考对了吗?原因就是前述所说的,如果分号后面有数字,所得到的切片,不包含该数字所对应的序号(前包括,后不包括)。那么,是不是可以这样呢?`lang[1:12]`,不包括12号(事实没有12号),是不是可以得到1到11号对应的字符呢? - - >>> lang[1:12] - 'tudy python' - >>> lang[1:13] - 'tudy python' - -果然是。并且不仅仅后面写12,写13,也能得到同样的结果。但是,我这个特别要提醒,这种获得切片的做法在编程实践中是不提倡的。特别是如果后面要用到循环的时候,这样做或许在什么时候遇到麻烦。 - -如果在切片的时候,冒号左右都不写数字,就是前面所操作的`c = lang[:]`,其结果是变量c的值与原字符串一样,也就是“复制”了一份。注意,这里的“复制”我打上了引号,意思是如同复制,是不是真的复制呢?可以用下面的方式检验一下 - - >>> id(c) - 3071934536L - >>> id(lang) - 3071934536L - -`id()`的作用就是查看该对象在内存地址(就是在内存中的位置编号)。从上面可以看出,两个的内存地址一样,说明c和lang两个变量指向的是同一个对象。用`c=lang[:]`的方式,并没有生成一个新的字符串,而是将变量c这个标签也贴在了原来那个字符串上了。 - - >>> lang = "study python" - >>> c = lang - -如果这样操作,变量c和lang是不是指向同一个对象呢?或者两者所指向的对象内存地址如何呢?看官可以自行查看。 - -##字符串基本操作 - -字符串是一种序列,所有序列都有如下基本操作: - -1. len():求序列长度 -2. + :连接2个序列 -3. * : 重复序列元素 -4. in :判断元素是否存在于序列中 -5. max() :返回最大值 -6. min() :返回最小值 -7. cmp(str1,str2) :比较2个序列值是否相同 - -通过下面的例子,将这几个基本操作在字符串上的使用演示一下: - -###“+”连接字符串 - - >>> str1 + str2 - 'abcdabcde' - >>> str1 + "-->" + str2 - 'abcd-->abcde' - -这其实就是拼接,不过在这里,看官应该有一个更大的观念,我们现在只是学了字符串这一种序列,后面还会遇到列表、元组两种序列,都能够如此实现拼接。 - -###in - - >>> "a" in str1 - True - >>> "de" in str1 - False - >>> "de" in str2 - True - -`in`用来判断某个字符串是不是在另外一个字符串内,或者说判断某个字符串内是否包含某个字符串,如果包含,就返回`True`,否则返回`False`。 - -###最值 - - >>> max(str1) - 'd' - >>> max(str2) - 'e' - >>> min(str1) - 'a' - -一个字符串中,每个字符在计算机内都是有编码的,也就是对应着一个数字,`min()`和`max()`就是根据这个数字里获得最小值和最大值,然后对应出相应的字符。关于这种编号是多少,看官可以google有关字符编码,或者ASCII编码什么的,很容易查到。 - -###比较 - - >>> cmp(str1, str2) - -1 - -将两个字符串进行比较,也是首先将字符串中的符号转化为对一个的数字,然后比较。如果返回的数值小于零,说明第一个小于第二个,等于0,则两个相等,大于0,第一个大于第二个。为了能够明白其所以然,进入下面的分析。 - - >>> ord('a') - 97 - >>> ord('b') - 98 - >>> ord(' ') - 32 - -`ord()`是一个内建函数,能够返回某个字符(注意,是一个字符,不是多个字符组成的串)所对一个的ASCII值(是十进制的),字符a在ASCII中的值是97,空格在ASCII中也有值,是32。顺便说明,反过来,根据整数值得到相应字符,可以使用`chr()`: - - >>> chr(97) - 'a' - >>> chr(98) - 'b' - -于是,就得到如下比较结果了: - - >>> cmp("a","b") #a-->97, b-->98, 97小于98,所以a小于b - -1 - >>> cmp("abc","aaa") - 1 - >>> cmp("a","a") - 0 - -看看下面的比较,是怎么进行的呢? - - >>> cmp("ad","c") - -1 - -在字符串的比较中,是两个字符串的第一个字符先比较,如果相等,就比较下一个,如果不相等,就返回结果。直到最后,如果还相等,就返回0。位数不够时,按照没有处理(注意,没有不是0,0在ASCII中对应的是NUL),位数多的那个天然大了。ad中的a先和后面的c进行比较,显然a小于c,于是就返回结果-1。如果进行下面的比较,是最容易让人迷茫的。看官能不能根据刚才阐述的比较远离理解呢? - - >>> cmp("123","23") - -1 - >>> cmp(123,23) #也可以比较整数,这时候就是整数的直接比较了。 - 1 - -###“*” - -字符串中的“乘法”,这个乘法,就是重复那个字符串的含义。在某些时候很好用的。比如我要打印一个华丽的分割线: - - >>> str1*3 - 'abcdabcdabcd' - >>> print "-"*20 #不用输入很多个`-` - -------------------- - -###len() - -要知道一个字符串有多少个字符,一种方法是从头开始,盯着屏幕数一数。哦,这不是计算机在干活,是键客在干活。 - ->键客,不是剑客。剑客是以剑为武器的侠客;而键客是以键盘为武器的侠客。当然,还有贱客,那是贱人的最高境界,贱到大侠的程度,比如岳不群之流。 - -键客这样来数字符串长度: - - >>> a="hello" - >>> len(a) - 5 - -使用的是一个函数len(object)。得到的结果就是该字符串长度。 - - >>> m = len(a) #把结果返回后赋值给一个变量 - >>> m - 5 - >>> type(m) #这个返回值(变量)是一个整数型 - - ------- - -[总目录](./index.md)   |   [上节:字符串(2)](./107.md)   |   [下节:字符串(4)](./109.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 diff --git a/109.md b/109.md deleted file mode 100644 index 3fd58b7..0000000 --- a/109.md +++ /dev/null @@ -1,270 +0,0 @@ ->所以你施舍的时候,不可在你前面吹号,像那假冒为善的人,在会堂里和街道上所行的,故意要得人的荣耀。我实在告诉你们,他们已经得了他们的上次。你施舍的时候,不要叫左手知道右手所作的。要叫你施舍的事行在暗中,你父在暗中察看,必然报答你。(MATTHEW 6:2-4) - -#字符串(4) - -字符串的内容的确不少,甚至都有点啰嗦了。但是,本节依然还要继续,就是因为在编程实践中,经常会遇到有关字符串的问题,而且也是很多初学者容易迷茫的。 - -##字符串格式化输出 - -什么是格式化?在维基百科中有专门的词条,这么说的: - ->格式化是指对磁盘或磁盘中的分区(partition)进行初始化的一种操作,这种操作通常会导致现有的磁盘或分区中所有的文件被清除。 - -不知道你是否知道这种“格式化”。显然,此格式化非我们这里所说的,我们说的是字符串的格式化,或者说成“格式化字符串”,都可以,表示的意思就是: - ->格式化字符串,是C、C++等程序设计语言printf类函数中用于指定输出参数的格式与相对位置的字符串参数。其中的转换说明(conversion specification)用于把随后对应的0个或多个函数参数转换为相应的格式输出;格式化字符串中转换说明以外的其它字符原样输出。 - -这也是来自维基百科的定义。在这个定义中,是用C语言作为例子,并且用了其输出函数来说明。在python中,也有同样的操作和类似的函数`print`,此前我们已经了解一二了。 - -如果将那个定义说的通俗一些,字符串格式化化,就是要先制定一个模板,在这个模板中某个或者某几个地方留出空位来,然后在那些空位填上字符串。那么,那些空位,需要用一个符号来表示,这个符号通常被叫做占位符(仅仅是占据着那个位置,并不是输出的内容)。 - - >>> "I like %s" - 'I like %s' - -在这个字符串中,有一个符号:`%s`,就是一个占位符,这个占位符可以被其它的字符串代替。比如: - - >>> "I like %s" % "python" - 'I like python' - >>> "I like %s" % "Pascal" - 'I like Pascal' - -这是较为常用的一种字符串输出方式。 - -另外,不同的占位符,会表示那个位置应该被不同类型的对象填充。下面列出许多,供参考。不过,不用记忆,常用的只有`%s`和`%d`,或者再加上`%f`,其它的如果需要了,到这里来查即可。 - -占位符|说明 -------|--- -%s |字符串(采用str()的显示) -%r |字符串(采用repr()的显示) -%c |单个字符 -%b |二进制整数 -%d |十进制整数 -%i |十进制整数 -%o |八进制整数 -%x |十六进制整数 -%e |指数 (基底写为e) -%E |指数 (基底写为E) -%f |浮点数 -%F |浮点数,与上相同 -%g |指数(e)或浮点数 (根据显示长度) -%G |指数(E)或浮点数 (根据显示长度) - -看例子: - - >>> a = "%d years" % 15 - >>> print a - 15 years - -当然,还可以在一个字符串中设置多个占位符,就像下面一样 - - >>> print "Suzhou is more than %d years. %s lives in here." % (2500, "qiwsir") - Suzhou is more than 2500 years. qiwsir lives in here. - -对于浮点数字的打印输出,还可以限定输出的小数位数和其它样式。 - - >>> print "Today's temperature is %.2f" % 12.235 - Today's temperature is 12.23 - >>> print "Today's temperature is %+.2f" % 12.235 - Today's temperature is +12.23 - -注意,上面的例子中,没有实现四舍五入的操作。只是截取。 - -关于类似的操作,还有很多变化,比如输出格式要宽度是多少等等。如果看官在编程中遇到了,可以到网上查找。我这里给一个参考图示,也是从网上抄来的。 - -![](./1images/10901.png) - -其实,上面这种格式化方法,常常被认为是太“古老”了。因为在python中还有新的格式化方法。 - - >>> s1 = "I like {}".format("python") - >>> s1 - 'I like python' - >>> s2 = "Suzhou is more than {} years. {} lives in here.".format(2500, "qiwsir") - >>> s2 - 'Suzhou is more than 2500 years. qiwsir lives in here.' - -这就是python非常提倡的`string.format()`的格式化方法,其中`{}`作为占位符。 - -这种方法真的是非常好,而且非常简单,只需要将对应的东西,按照顺序在format后面的括号中排列好,分别对应占位符`{}`即可。我喜欢的方法。 - -如果你觉得还不明确,还可以这样来做。 - - >>> print "Suzhou is more than {year} years. {name} lives in here.".format(year=2500, name="qiwsir") - Suzhou is more than 2500 years. qiwsir lives in here. - -真的很简洁,看成优雅。 - -其实,还有一种格式化的方法,被称为“字典格式化”,这里仅仅列一个例子,如果看官要了解字典的含义,本教程后续会有的。 - - >>> lang = "python" - >>> print "I love %(program)s"%{"program":lang} - I love python - -列举了三种基本格式化的方法,你喜欢那种?我推荐:`string.format()` - -##常用的字符串方法 - -字符串的方法很多。可以通过dir来查看: - - >>> dir(str) - ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill'] - -这么多,不会一一介绍,要了解某个具体的含义和使用方法,最好是使用help查看。举例: - - >>> help(str.isalpha) - - Help on method_descriptor: - - isalpha(...) - S.isalpha() -> bool - - Return True if all characters in S are alphabetic - and there is at least one character in S, False otherwise. - -按照这里的说明,就可以在交互模式下进行实验。 - - >>> "python".isalpha() #字符串全是字母,应该返回True - True - >>> "2python".isalpha() #字符串含非字母,返回False - False - -###split - -这个函数的作用是将字符串根据某个分割符进行分割。 - - >>> a = "I LOVE PYTHON" - >>> a.split(" ") - ['I', 'LOVE', 'PYTHON'] - -这是用空格作为分割,得到了一个名字叫做列表(list)的返回值,关于列表的内容,后续会介绍。还能用别的分隔吗? - - >>> b = "www.itdiffer.com" - >>> b.split(".") - ['www', 'itdiffer', 'com'] - -###去掉字符串两头的空格 - -这个功能,在让用户输入一些信息的时候非常有用。有的朋友喜欢输入结束的时候敲击空格,比如让他输入自己的名字,输完了,他来个空格。有的则喜欢先加一个空格,总做的输入的第一个字前面应该空两个格。 - -这些空格是没用的。python考虑到有不少人可能有这个习惯,因此就帮助程序员把这些空格去掉。 - -方法是: - -- S.strip() 去掉字符串的左右空格 -- S.lstrip() 去掉字符串的左边空格 -- S.rstrip() 去掉字符串的右边空格 - -例如: - - >>> b=" hello " #两边有空格 - >>> b.strip() - 'hello' - >>> b - ' hello ' - -特别注意,原来的值没有变化,而是新返回了一个结果。 - - >>> b.lstrip() #去掉左边的空格 - 'hello ' - >>> b.rstrip() #去掉右边的空格 - ' hello' - -###字符大小写的转换 - -对于英文,有时候要用到大小写转换。最有名驼峰命名,里面就有一些大写和小写的参合。如果有兴趣,可以来这里看[自动将字符串转化为驼峰命名形式的方法](https://github.com/qiwsir/algorithm/blob/master/string_to_hump.md)。 - -在python中有下面一堆内建函数,用来实现各种类型的大小写转化 - -- S.upper() #S中的字母大写 -- S.lower() #S中的字母小写 -- S.capitalize() #首字母大写 -- S.isupper() #S中的字母是否全是大写 -- S.islower() #S中的字母是否全是小写 -- S.istitle() - -看例子: - - >>> a = "qiwsir,python" - >>> a.upper() #将小写字母完全变成大写字母 - 'QIWSIR,PYTHON' - >>> a #原数据对象并没有改变 - 'qiwsir,python' - >>> b = a.upper() - >>> b - 'QIWSIR,PYTHON' - >>> c = b.lower() #将所有的小写字母变成大写字母 - >>> c - 'qiwsir,python' - - >>> a - 'qiwsir,python' - >>> a.capitalize() #把字符串的第一个字母变成大写 - 'Qiwsir,python' - >>> a #原数据对象没有改变 - 'qiwsir,python' - >>> b = a.capitalize() #新建立了一个 - >>> b - 'Qiwsir,python' - - >>> a = "qiwsir,github" #这里的问题就是网友白羽毛指出的,非常感谢他。 - >>> a.istitle() - False - >>> a = "QIWSIR" #当全是大写的时候,返回False - >>> a.istitle() - False - >>> a = "qIWSIR" - >>> a.istitle() - False - >>> a = "Qiwsir,github" #如果这样,也返回False - >>> a.istitle() - False - >>> a = "Qiwsir" #这样是True - >>> a.istitle() - True - >>> a = 'Qiwsir,Github' #这样也是True - >>> a.istitle() - True - - >>> a = "Qiwsir" - >>> a.isupper() - False - >>> a.upper().isupper() - True - >>> a.islower() - False - >>> a.lower().islower() - True - -顺着白羽毛网友指出的,再探究一下,可以这么做: - - >>> a = "This is a Book" - >>> a.istitle() - False - >>> b = a.title() #这样就把所有单词的第一个字母转化为大写 - >>> b - 'This Is A Book' - >>> b.istitle() #判断每个单词的第一个字母是否为大写 - True - -###join拼接字符串 - -用“+”能够拼接字符串,但不是什么情况下都能够如愿的。比如,将列表(关于列表,后续详细说,它是另外一种类型)中的每个字符(串)元素拼接成一个字符串,并且用某个符号连接,如果用“+”,就比较麻烦了(是能够实现的,麻烦)。 - -用字符串的join就比较容易实现。 - - >>> b - 'www.itdiffer.com' - >>> c = b.split(".") - >>> c - ['www', 'itdiffer', 'com'] - >>> ".".join(c) - 'www.itdiffer.com' - >>> "*".join(c) - 'www*itdiffer*com' - -这种拼接,是不是简单呢? - ------- - -[总目录](./index.md)   |   [上节:字符串(3)](./108.md)   |   [下节:字符编码](./110.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/110.md b/110.md deleted file mode 100644 index 9b7c105..0000000 --- a/110.md +++ /dev/null @@ -1,170 +0,0 @@ ->So do not worry about tomorrow, for tomorrow will bring worries of its own. Today's trouble is enough for today. (MATTHEW 6:34) - -#字符编码 - -我在第一版的《零基础学python》中,这个标题前面加了“坑爹”两个字。在后来的实践中,很多朋友都在网上问我关于编码的事情。说明这的确是一个“坑”。 - -首先说明,在python2中,编码问题的确有点麻烦。但是,python3就不用纠结于此了。但是,正如前面所说的原因,至少本教程还是用python2,所以,必须要搞清楚编码。当然了,搞清楚,也不是坏事。 - -字符编码,在编程中,是一个让学习者比较郁闷的东西,比如一个str,如果都是英文,好说多了。但恰恰不是如此,中文是我们不得不用的。所以,哪怕是初学者,都要了解并能够解决字符编码问题。 - - >>> name = '老齐' - >>> name - '\xe8\x80\x81\xe9\xbd\x90' - -在你的编程中,你遇到过上面的情形吗?认识最下面一行打印出来的东西吗?看人家英文,就好多了 - - >>> name = "qiwsir" - >>> name - 'qiwsir' - -难道这是中文的错吗?看来投胎真的是一个技术活。是的,投胎是技术活,但上面的问题不是中文的错。 - -##编码 - -什么是编码?这是一个比较玄乎的问题。也不好下一个普通定义。我看到有的教材中有定义,不敢说他的定义不对,至少可以说不容易理解。 - -古代打仗,击鼓进攻、鸣金收兵,这就是编码。吧要传达给士兵的命令对应为一定的其它形式,比如命令“进攻”,经过如此的信息传递: - -![](./1images/11001.png) - -1. 长官下达进攻命令,传令员将这个命令编码为鼓声(如果复杂点,是不是有几声鼓响,如何进攻呢?)。 -2. 鼓声在空气中传播,比传令员的嗓子吼出来的声音传播的更远,士兵听到后也不会引起歧义,一般不会有士兵把鼓声当做打呼噜的声音。这就是“进攻”命令被编码成鼓声之后的优势所在。 -3. 士兵听到鼓声,就是接收到信息之后,如果接受过训练或者有人告诉过他们,他们就知道这是让我进攻。这个过程就是解码。所以,编码方案要有两套。一套在信息发出者那里,另外一套在信息接受者这里。经过解码之后,士兵明白了,才行动。 - -以上过程比较简单。其实,真实的编码和解码过程,要复杂了。不过,原理都差不多的。 - -举一个似乎遥远,其实不久前人们都在使用的东西做例子:[电报](http://zh.wikipedia.org/wiki/%E7%94%B5%E6%8A%A5) - ->电报是通信业务的一种,在19世纪初发明,是最早使用电进行通信的方法。电报大为加快了消息的流通,是工业社会的其中一项重要发明。早期的电报只能在陆地上通讯,后来使用了海底电缆,开展了越洋服务。到了20世纪初,开始使用无线电拨发电报,电报业务基本上已能抵达地球上大部份地区。电报主要是用作传递文字讯息,使用电报技术用作传送图片称为传真。 - ->中国首条出现电报线路是1871年,由英国、俄国及丹麦敷设,从香港经上海至日本长崎的海底电缆。由于清政府的反对,电缆被禁止在上海登陆。后来丹麦公司不理清政府的禁令,将线路引至上海公共租界,并在6月3日起开始收发电报。至于首条自主敷设的线路,是由福建巡抚丁日昌在台湾所建,1877年10月完工,连接台南及高雄。1879年,北洋大臣李鸿章在天津、大沽及北塘之间架设电报线路,用作军事通讯。1880年,李鸿章奏准开办电报总局,由盛宣怀任总办。并在1881年12月开通天津至上海的电报服务。李鸿章説:“五年来,我国创设沿江沿海各省电线,总计一万多里,国家所费无多,巨款来自民间。当时正值法人挑衅,将帅报告军情,朝廷传达指示,均相机而动,无丝毫阻碍。中国自古用兵,从未如此神速。出使大臣往来问答,朝发夕至,相隔万里好似同居庭院。举设电报一举三得,既防止外敌侵略,又加强国防,亦有利于商务。”天津官电局于庚子遭乱全毁。1887年,台湾巡抚刘铭传敷设了福州至台湾的海底电缆,是中国首条海底电缆。1884年,北京电报开始建设,采用"安设双线,由通州展至京城,以一端引入署中,专递官信,以一端择地安置用便商民",同年8月5日,电报线路开始建设,所有电线杆一律漆成红色。8月22日,位于北京崇文门外大街西的喜鹊胡同的外城商用电报局开业。同年8月30日,位于崇文门内泡子和以西的吕公堂开局,专门收发官方电报。 - ->为了传达汉字,电报部门准备由4位数字或3位罗马字构成的代码,即中文电码,采用发送前将汉字改写成电码发出,收电报后再将电码改写成汉字的方法。 - -列位看官注意了,这里出现了电报中用的“[中文电码](http://zh.wikipedia.org/wiki/%E4%B8%AD%E6%96%87%E9%9B%BB%E7%A2%BC)”,这就是一种编码,将汉字对应成阿拉伯数字,从而能够用电报发送汉字。 - ->1873年,法国驻华人员威基杰参照《康熙字典》的部首排列方法,挑选了常用汉字6800多个,编成了第一部汉字电码本《电报新书》。 - -电报中的编码被称为[摩尔斯电码,英文是Morse Code](http://zh.wikipedia.org/wiki/%E6%91%A9%E6%96%AF%E7%94%B5%E7%A0%81) - ->摩尔斯电码(英语:Morse Code)是一种时通时断的信号代码,通过不同的排列顺序来表达不同的英文字母、数字和标点符号。是由美国人萨缪尔·摩尔斯在1836年发明。 - ->摩尔斯电码是一种早期的数字化通信形式,但是它不同于现代只使用0和1两种状态的二进制代码,它的代码包括五种:点(.)、划(-)、每个字符间短的停顿(在点和划之间的停顿)、每个词之间中等的停顿、以及句子之间长的停顿 - -看来电报员是一个技术活,不同长短的停顿都代表了不同意思。哦,对了,有一个老片子《永不消逝的电波》,看完之后保证你才知道,里面根本就没有讲电报是怎么编码的。 - ->摩尔斯电码在海事通讯中被作为国际标准一直使用到1999年。1997年,当法国海军停止使用摩尔斯电码时,发送的最后一条消息是:“所有人注意,这是我们在永远沉寂之前最后的一声呐喊!” - -![](./1mages/11002.png) - -我瞪着眼看了老长时间,这两行不是一样的吗? - -不管这个了,总之,这就是编码。 - -##计算机中的字符编码 - -先抄一段[维基百科对字符编码](http://zh.wikipedia.org/wiki/%E5%AD%97%E7%AC%A6%E7%BC%96%E7%A0%81)的解释: - ->字符编码(英语:Character encoding)、字集码是把字符集中的字符编码为指定集合中某一对象(例如:比特模式、自然数串行、8位组或者电脉冲),以便文本在计算机中存储和通过通信网络的传递。常见的例子包括将拉丁字母表编码成摩斯电码和ASCII。其中,ASCII将字母、数字和其它符号编号,并用7比特的二进制来表示这个整数。通常会额外使用一个扩充的比特,以便于以1个字节的方式存储。 - ->在计算机技术发展的早期,如ASCII(1963年)和EBCDIC(1964年)这样的字符集逐渐成为标准。但这些字符集的局限很快就变得明显,于是人们开发了许多方法来扩展它们。对于支持包括东亚CJK字符家族在内的写作系统的要求能支持更大量的字符,并且需要一种系统而不是临时的方法实现这些字符的编码。 - -在这个世界上,有好多不同的字符编码。但是,它们不是自己随便搞搞的。而是要有一定的基础,往往是以名叫[ASCII](http://zh.wikipedia.org/wiki/ASCII)的编码为基础,这里边也应该包括北朝鲜吧(不知道他们用什么字符编码,瞎想的,别当真,不代表本教材立场,只代表瞎想)。 - ->ASCII(pronunciation: 英语发音:/ˈæski/ ASS-kee[1],American Standard Code for Information Interchange,美国信息交换标准代码)是基于拉丁字母的一套电脑编码系统。它主要用于显示现代英语,而其扩展版本EASCII则可以部分支持其他西欧语言,并等同于国际标准ISO/IEC 646。由于万维网使得ASCII广为通用,直到2007年12月,逐渐被Unicode取代。 - -上面的引文中已经说了,现在我们用的编码标准已经变成Unicode了,那么什么是Unicode呢?还是抄一段来自[维基百科的说明](http://zh.wikipedia.org/wiki/Unicode) - ->Unicode(中文:万国码、国际码、统一码、单一码)是计算机科学领域里的一项业界标准。它对世界上大部分的文字系统进行了整理、编码,使得电脑可以用更为简单的方式来呈现和处理文字。 - ->Unicode伴随着通用字符集的标准而发展,同时也以书本的形式对外发表。Unicode至今仍在不断增修,每个新版本都加入更多新的字符。目前最新的版本为7.0.0,已收入超过十万个字符(第十万个字符在2005年获采纳)。Unicode涵盖的数据除了视觉上的字形、编码方法、标准的字符编码外,还包含了字符特性,如大小写字母。 - -听这名字:万国码,那就一定包含了中文喽。的确是。但是,光有一个Unicode还不行,因为....(此处省略若干字,看官可以到上面给出的维基百科链接中看),还要有其它的一些编码实现方式,Unicode的实现方式称为Unicode转换格式(Unicode Transformation Format,简称为UTF),于是乎有了一个我们在很多时候都会看到的utf-8。 - -什么是utf-8,还是看[维基百科](http://zh.wikipedia.org/wiki/UTF-8)上怎么说的吧 - ->UTF-8(8-bit Unicode Transformation Format)是一种针对Unicode的可变长度字符编码,也是一种前缀码。它可以用来表示Unicode标准中的任何字符,且其编码中的第一个字节仍与ASCII兼容,这使得原来处理ASCII字符的软件无须或只须做少部份修改,即可继续使用。因此,它逐渐成为电子邮件、网页及其他存储或发送文字的应用中,优先采用的编码。 - -不再多引用了,如果要看更多,请到原文。 - -看官现在是不是就理解了,前面写程序的时候,曾经出现过:coding:utf-8的字样。就是在告诉python我们要用什么字符编码呢。 - -##encode和decode - -历史部分说完了,接下怎么讲?比较麻烦了。因为不管怎么讲,都不是三言两语说清楚的。姑且从encode()和decode()两个内置函数起吧。 - ->codecs.encode(obj[, encoding[, errors]]):Encodes obj using the codec registered for encoding. ->codecs.decode(obj[, encoding[, errors]]):Decodes obj using the codec registered for encoding. - -python2默认的编码是ascii,通过encode可以将对象的编码转换为指定编码格式(称作“编码”),而decode是这个过程的逆过程(称作“解码”)。 - -做一个实验,才能理解: - - >>> a = "中" - >>> type(a) - - >>> a - '\xe4\xb8\xad' - >>> len(a) - 3 - - >>> b = a.decode() - >>> b - u'\u4e2d' - >>> type(b) - - >>> len(b) - 1 - -这个实验不做之前,或许看官还不是很迷茫(因为不知道,知道的越多越迷茫),实验做完了,自己也迷茫了。别急躁,对编码问题的理解,要慢慢来,如果一时理解不了,也肯定理解不了,就先注意按照要求做,做着做着就豁然开朗了。 - -上面试验中,变量a引用了一个字符串,所谓字符串(str),严格地将是字节串,它是经过编码后的字节组成的序列。也就是你在上面的实验中,看到的是“中”这个字在计算机中编码之后的字节表示。(关于字节,看官可以google一下)。用len(a)来度量它的长度,它是由三个字节组成的。 - -然后通过decode函数,将**字节串**转变为**字符串**,并且这个字符串是按照unicode编码的。在unicode编码中,一个汉字对应一个字符,这时候度量它的长度就是1. - -反过来,一个unicode编码的字符串,也可以转换为字节串。 - - >>> c = b.encode('utf-8') - >>> c - '\xe4\xb8\xad' - >>> type(c) - - >>> c == a - True - -关于编码问题,先到这里,点到为止吧。因为再扯,还会扯出问题来。看官肯定感到不满意,因为还没有知其所以然。没关系,请尽情google,即可解决。 - -##python中如何避免中文是乱码 - -这个问题是一个具有很强操作性的问题。我这里有一个经验总结,分享一下,供参考: - -首先,提倡使用utf-8编码方案,因为它跨平台不错。 - -经验一:在开头声明: - - # -*- coding: utf-8 -*- - -有朋友问我-*-有什么作用,那个就是为了好看,爱美之心人皆有,更何况程序员?当然,也可以写成: - - # coding:utf-8 - -经验二:遇到字符(节)串,立刻转化为unicode,不要用str(),直接使用unicode() - - unicode_str = unicode('中文', encoding='utf-8') - print unicode_str.encode('utf-8') - -经验三:如果对文件操作,打开文件的时候,最好用codecs.open,替代open(这个后面会讲到,先放在这里) - - import codecs - codecs.open('filename', encoding='utf8') - -我还收集了网上的一片文章,也挺好的,推荐给看官:[Python2.x的中文显示方法](https://github.com/qiwsir/ITArticles/blob/master/Python/Python%E7%9A%84%E4%B8%AD%E6%96%87%E6%98%BE%E7%A4%BA%E6%96%B9%E6%B3%95.md) - -最后告诉给我,如果用python3,坑爹的编码问题就不烦恼了。 - ------- - -[总目录](./index.md)   |   [上节:字符串(4)](./109.md)   |   [下节:列表(1)](./111.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 diff --git a/111.md b/111.md deleted file mode 100644 index dbfc476..0000000 --- a/111.md +++ /dev/null @@ -1,268 +0,0 @@ ->你们不要论断人,免得你们被论断。因为你们怎样论断人,也必怎样被论断。你们用甚么量器量给人,也必用甚么量器量给你们。(MATTHEW 7:1-2) - -#列表(1) - -前面的学习中,我们已经知道了两种python的数据类型:int和str。再强调一下对数据类型的理解,这个世界是由数据组成的,数据可能是数字(注意,别搞混了,数字和数据是有区别的),也可能是文字、或者是声音、视频等。在python中(其它高级语言也类似)把状如2,3这样的数字划分为一个类型,把状如“你好”这样的文字划分一个类型,前者是int类型,后者是str类型(这里就不说翻译的名字了,请看官熟悉用英文的名称,对日后编程大有好处,什么好处呢?谁用谁知道!)。 - -前面还学习了变量,如果某个变量指向一个对象(某种类型的数据)行话是:赋值),通常这个变量我们就把它叫做int类型的变量(注意,这种说法是不严格的,或者是受到别的语言影响的,在python中,特别要注意:**变量没有类型,对象有类型**。在python里,变量不用提前声明(在某些语言,如JAVA中需要声明变量之后才能使用。这个如果看官没有了解,不用担心,因为我们是学习python,以后学习的语言多了,自然就能体会到这点区别了),随用随命名。 - -这一讲中的list类型,也是python的一种数据类型。翻译为:列表。下面的黑字,请看官注意了: - -**LIST在python中具有非常强大的功能。** - -##定义 - -在python中,用方括号表示一个list,[ ] - -在方括号里面,可以是int,也可以是str类型的数据,甚至也能够是True/False这种布尔值。看下面的例子,特别注意阅读注释。 - - >>> a=[] #定义了一个变量a,它是list类型,并且是空的。 - >>> type(a) - #用内置函数type()查看变量a的类型,为list - >>> bool(a) #用内置函数bool()看看list类型的变量a的布尔值,因为是空的,所以为False - False - >>> print a #打印list类型的变量a - [] - -`bool()`是一个布尔函数,这个东西后面会详述。它的作用就是来判断一个对象是“真”还是“空”(假)。如果想上面例子那样,list中什么也没有,就是空的,用bool()函数来判断,得到False,从而显示它是空的。 - -不能总玩空的,来点实的吧。 - - >>> a=['2',3,'qiwsir.github.io'] - >>> a - ['2', 3, 'qiwsir.github.io'] - >>> type(a) - - >>> bool(a) - True - >>> print a - ['2', 3, 'qiwsir.github.io'] - -用上述方法,定义一个list类型的变量和数据。 - -本讲的标题是“有容乃大的list”,就指明了list的一大特点:可以无限大,就是说list里面所能容纳的元素数量无限,当然这是在硬件设备理想的情况下。 - ->如果看官以后或者已经了解了别的语言,比如比较常见的Java,里面有一个跟list相似的数据类型——数组——但是两者还是有区别的。在Java中,数组中的元素必须是基本数据类型中某一个,也就是要么都是int类型,要么都是char类型等,不能一个数组中既有int类型又有char类型。这是因为java中的数组,需要提前声明,声明的时候就确定了里面元素的类型。但是python中的list,尽管跟java中的数组有类似的地方——都是`[]`包裹的——list中的元素是任意类型的,可以是int,str,甚至还可以是list,乃至于是以后要学的dict等。所以,有一句话说:List是python中的苦力,什么都可以干。 - -##索引和切片 - -尚记得在[《字符串(3)》](./108.md)中,曾经给“索引”(index)和“切片”。 - - >>> url = "qiwsir.github.io" - >>> url[2] - 'w' - >>> url[:4] - 'qiws' - >>> url[3:9] - 'sir.gi' - -在list中,也有类似的操作。只不过是以元素为单位,不是以字符为单位进行索引了。看例子就明白了。 - - >>> a - ['2', 3, 'qiwsir.github.io'] - >>> a[0] #索引序号也是从0开始 - '2' - >>> a[1] - 3 - >>> [2] - [2] - >>> a[:2] #跟str中的类似,切片的范围是:包含开始位置,到结束位置之前 - ['2', 3] #不包含结束位置 - >>> a[1:] - [3, 'qiwsir.github.io'] - -list和str两种类型的数据,有共同的地方,它们都属于序列(都是一些对象按照某个次序排列起来,这就是序列的最大特征),因此,就有很多类似的地方。如刚才演示的索引和切片,是非常一致的。 - - >>> lang = "python" - >>> lang.index("y") - 1 - >>> lst = ['python','java','c++'] - >>> lst.index('java') - 1 - -在前面讲述字符串索引和切片的时候,以及前面的演示,所有的索引都是从左边开始编号,第一个是0,然后依次增加1。此外,还有一种编号方式,就是从右边开始,右边第一个可以编号为`-1`,然后向左依次是:-2,-3,...,依次类推下来。这对字符串、列表等各种序列类型都是用。 - - >>> lang - 'python' - >>> lang[-1] - 'n' - >>> lst - ['python', 'java', 'c++'] - >>> lst[-1] - 'c++' - -从右边开始编号,第-1号是右边第一个。但是,如果要切片的话,应该注意了。 - - >>> lang[-1:-3] - '' - >>> lang[-3:-1] - 'ho' - >>> lst[-3:-1] - ['python', 'java'] - -序列的切片,一定要左边的数字小有右边的数字,`lang[-1:-3]`就没有遵守这个规则,返回的是一个空。 - -##反转 - -这个功能作为一个独立的项目提出来,是因为在编程中常常会用到。通过举例来说明反转的方法: - - >>> alst = [1,2,3,4,5,6] - >>> alst[::-1] #反转 - [6, 5, 4, 3, 2, 1] - >>> alst - [1, 2, 3, 4, 5, 6] - -当然,对于字符串也可以 - - >>> lang - 'python' - >>> lang[::-1] - 'nohtyp' - >>> lang - 'python' - -看官是否注意到,上述不管是str还是lst反转之后,再看原来的值,没有改变。这就说明,这里的反转,不是在“原地”把原来的值倒过来,而是新生成了一个值,那个值跟原来的值相比,是倒过来了。 - -这是一种非常简单的方法,虽然我在写程序的时候常常使用,但是,我不是十分推荐,因为有时候让人感觉迷茫。python还有另外一种方法让list反转,是比较容易理解和阅读的,特别推荐之: - - >>> list(reversed(alst)) - [6, 5, 4, 3, 2, 1] - -比较简单,而且很容易看懂。不是吗? - -顺便给出reversed函数的详细说明: - - >>> help(reversed) - Help on class reversed in module __builtin__: - - class reversed(object) - | reversed(sequence) -> reverse iterator over values of the sequence - | - | Return a reverse iterator - -它返回一个可以迭代的对象(关于迭代的问题,后续会详述之),不过是已经将原来的序列对象反转了。比如: - - >>> list(reversed("abcd")) - ['d', 'c', 'b', 'a'] - -很好,很强大,特别推荐使用。 - -##对list的操作 - -任何一个行业都有自己的行话,如同古代的强盗,把撤退称之为“扯乎”一样,纵然是一个含义,但是强盗们愿意用他们自己的行业用语,俗称“黑话”。各行各业都如此。这样做的目的我理解有两个,一个是某种保密;另外一个是行外人士显示本行业的门槛,让别人感觉这个行业很高深,从业者有一定水平。 - -不管怎么,在python和很多高级语言中,都给本来数学角度就是函数的东西,又在不同情况下有不同的称呼,如方法、类等。当然,这种称呼,其实也是为了区分函数的不同功能。 - -前面在对str进行操作的时候,有一些内置函数,比如s.strip(),这是去掉左右空格的内置函数,也是str的方法。按照一贯制的对称法则,对list也会有一些操作方法。 - -在讲述字符串的时候,提到过,所有的序列,都有几种基本操作。list当然如此。 - -###基本操作 - -- len() - -在交互模式中操作: - - >>> lst - ['python', 'java', 'c++'] - >>> len(lst) - 3 - -- +,连接两个序列 - -交互模式中: - - >>> lst - ['python', 'java', 'c++'] - >>> alst - [1, 2, 3, 4, 5, 6] - >>> lst + alst - ['python', 'java', 'c++', 1, 2, 3, 4, 5, 6] - -- *,重复元素 - -交互模式中操作 - - >>> lst - ['python', 'java', 'c++'] - >>> lst * 3 - ['python', 'java', 'c++', 'python', 'java', 'c++', 'python', 'java', 'c++'] - -- in - -列表lst还是前面的值 - - >>> "python" in lst - True - >>> "c#" in lst - False - -- max()和min() - -以int类型元素为例。如果不是,都是按照字符在ascii编码中所对应的数字进行比较的。 - - >>> alst - [1, 2, 3, 4, 5, 6] - >>> max(alst) - 6 - >>> min(alst) - 1 - >>> max(lst) - 'python' - >>> min(lst) - 'c++' - -- comp() - -采用上面的方法,进行比较 - - >>> lsta = [2,3] - >>> lstb = [2,4] - >>> cmp(lsta,lstb) - -1 - >>> lstc = [2] - >>> cmp(lsta,lstc) - 1 - >>> lstd = ['2','3'] - >>> cmp(lsta,lstd) - -1 - -###追加元素 - - >>> a = ["good","python","I"] - >>> a - ['good', 'python', 'I'] - >>> a.append("like") #向list中添加str类型"like" - >>> a - ['good', 'python', 'I', 'like'] - >>> a.append(100) #向list中添加int类型100 - >>> a - ['good', 'python', 'I', 'like', 100] - -[官方文档](https://docs.python.org/2/tutorial/datastructures.html)这样描述list.append()方法 - ->list.append(x) - -> Add an item to the end of the list; equivalent to a[len(a):] = [x]. - -从以上描述中,以及本部分的标题“追加元素”,是不是能够理解list.append(x)的含义呢?即将新的元素x追加到list的尾部。 - -列位看官,如果您注意看上面官方文档中的那句话,应该注意到,还有后面半句: equivalent to a[len(a):] = [x],意思是说list.append(x)等效于:a[len(a):]=[x]。这也相当于告诉我们了另外一种追加元素的方法,并且两种方法等效。 - - >>> a - ['good', 'python', 'I', 'like', 100] - >>> a[len(a):]=[3] #len(a),即得到list的长度,这个长度是指list中的元素个数。 - >>> a - ['good', 'python', 'I', 'like', 100, 3] - >>> len(a) - 6 - >>> a[6:]=['xxoo'] - >>> a - ['good', 'python', 'I', 'like', 100, 3, 'xxoo'] - ------- - -[总目录](./index.md)   |   [上节:字符编码](./110.md)   |   [下节:列表(2)](./112.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 - diff --git a/112.md b/112.md deleted file mode 100644 index ab03268..0000000 --- a/112.md +++ /dev/null @@ -1,265 +0,0 @@ ->你们祈求,就给你们;寻找,就寻见;叩门,就给你们开门。因为凡祈求的,就得着;寻找的,就寻见;叩门的,就给他们开门。 - ->所以无论何事,你们愿意人怎样待你们,你们也要怎样待人,因为这就是律法和先知的道理。(MATTHEW 7:7-8,12) - -#列表(2) - -上一节中已经谈到,list是python的苦力,那么它都有哪些函数呢?或者它或者对它能做什么呢?在交互模式下这么操作,就看到有关它的函数了。 - - >>> dir(list) - ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__delslice__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] - -上面的结果中,以双下划线开始和结尾的暂时不管,如`__add__`(以后会管的)。就剩下以下几个了: - ->'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort' - -下面注意对这些函数进行说明和演示。这都是在编程实践中常常要用到的。 - -##list函数 - -###append和extend - -[《列表(1)》](./111.md)中,对list的基本操作提到了list.append(x),也就是将某个元素x 追加到已知的一个list后边。 - -除了将元素追加到list中,还能够将两个list合并,或者说将一个list追加到另外一个list中。按照前文的惯例,还是首先看[官方文档](https://docs.python.org/2/tutorial/datastructures.html)中的描述: - ->list.extend(L) - -> Extend the list by appending all the items in the given list; equivalent to a[len(a):] = L. - -**向所有正在学习本内容的朋友提供一个成为优秀程序员的必备:看官方文档,是必须的。** - -官方文档的这句话翻译过来: - ->通过将所有元素追加到已知list来扩充它,相当于a[len(a):]= L - -英语太烂,翻译太差。直接看例子,更明白 - - >>> la - [1, 2, 3] - >>> lb - ['qiwsir', 'python'] - >>> la.extend(lb) - >>> la - [1, 2, 3, 'qiwsir', 'python'] - >>> lb - ['qiwsir', 'python'] - -上面的例子,显示了如何将两个list,一个是la,另外一个lb,将lb追加到la的后面,也就是把lb中的所有元素加入到la中,即让la扩容。 - -学程序一定要有好奇心,我在交互环境中,经常实验一下自己的想法,有时候是比较愚蠢的想法。 - - >>> la = [1,2,3] - >>> b = "abc" - >>> la.extend(b) - >>> la - [1, 2, 3, 'a', 'b', 'c'] - >>> c = 5 - >>> la.extend(c) - Traceback (most recent call last): - File "", line 1, in - TypeError: 'int' object is not iterable - -从上面的实验中,看官能够有什么心得?原来,如果extend(str)的时候,str被以字符为单位拆开,然后追加到la里面。 - -如果extend的对象是数值型,则报错。 - -所以,extend的对象是一个list,如果是str,则python会先把它按照字符为单位转化为list再追加到已知list。 - -不过,别忘记了前面官方文档的后半句话,它的意思是: - - >>> la - [1, 2, 3, 'a', 'b', 'c'] - >>> lb - ['qiwsir', 'python'] - >>> la[len(la):]=lb - >>> la - [1, 2, 3, 'a', 'b', 'c', 'qiwsir', 'python'] - -list.extend(L) 等效于 list[len(list):] = L,L是待并入的list - -联想到到[上一讲](./111.md)中的一个list函数list.append(),有类似之处。 - ->extend(...) -> L.extend(iterable) -- extend list by appending elements from the iterable - -上面是在交互模式中输入`help(list.extend)`后得到的说明。这是非常重要而且简单的获得文档帮助的方法。 - -从上面内容可知,extend函数也是将另外的元素增加到一个已知列表中,其元素必须是iterable,什么是iterable?这个从现在开始,后面会经常遇到,所以是要搞搞清楚的。 - ->iterable,中文含义是“可迭代的”。在python中,还有一个词,就是iterator,这个叫做“迭代器”。这两者有着区别和联系。不过,这里暂且不说那么多,说多了就容易糊涂,我也糊涂了。 - -为了解释iterable(可迭代的),又引入了一个词“迭代”,什么是迭代呢? - ->尽管我们很多文档是用英文写的,但是,如果你能充分利用汉语来理解某些名词,是非常有帮助的。因为在汉语中,不仅仅表音,而且能从词语组合中体会到该术语的含义。比如“激光”,这是汉语。英语是从"light amplification by stimulated emission of radiation"化出来的"laser",它是一个造出来的词。因为此前人们不知道那种条件下发出来的是什么。但是汉语不然,反正用一个“光”就可以概括了,只不过这个“光”不是传统概念中的“光”,而是由于“受激”辐射得到的光,故名“激光”。是不是汉语很牛叉? - ->“迭”在汉语中的意思是“屡次,反复”。如:高潮迭起。那么跟“代”组合,就可以理解为“反复‘代’”,是不是有点“子子孙孙”的意思了?“结婚-生子-子成长-结婚-生子-子成长-...”,你是不是也在这个“迭代”的过程中呢? - ->给个稍微严格的定义,来自维基百科。“迭代是重复反馈过程的活动,其目的通常是为了接近并到达所需的目标或结果。” - -某些类型的对象是“可迭代”(iterable)的,这类数据类型有共同的特点。如何判断一个对象是不是可迭代的?下面演示一种方法。事实上还有别的方式。 - - >>> astr = "python" - >>> hasattr(astr,'__iter__') - False - -这里用内建函数`hasattr()`判断一个字符串是否是可迭代的,返回了False。用同样的方式可以判断: - - >>> alst = [1,2] - >>> hasattr(alst,'__iter__') - True - >>> hasattr(3, '__iter__') - False - -`hasattr()`的判断本质就是看那个类型中是否有`__iter__`函数。看官可以用`dir()`找一找,在数字、字符串、列表中,谁有`__iter__`。同样还可找一找dict,tuple两种类型对象是否含有这个方法。 - -以上穿插了一个新的概念“iterable”(可迭代的),现在回到extend上。这个函数需要的参数就是iterable类型的对象。 - - >>> new = [1,2,3] - >>> lst = ['python','qiwsir'] - >>> lst.extend(new) - >>> lst - ['python', 'qiwsir', 1, 2, 3] - >>> new - [1, 2, 3] - -通过extend函数,将[1,2,3]中的每个元素都拿出来,然后塞到lst里面,从而得到了一个跟原来的对象元素不一样的列表,后面的比原来的多了三个元素。上面说的有点啰嗦,只不过是为了把过程完整表达出来。 - -还要关注一下,从上面的演示中可以看出,lst经过extend函数操作之后,变成了一个貌似“新”的列表。这句话好像有点别扭,“貌似新”的,之所以这么说,是因为对“新的”可能有不同的理解。不放深挖一下。 - - >>> new = [1,2,3] - >>> id(new) - 3072383244L - - >>> lst = ['python', 'qiwsir'] - >>> id(lst) - 3069501420L - -用`id()`能够看到两个列表分别在内存中的“窝”的编号。 - - >>> lst.extend(new) - >>> lst - ['python', 'qiwsir', 1, 2, 3] - >>> id(lst) - 3069501420L - -看官注意到没有,虽然lst经过`extend()`方法之后,比原来扩容了,但是,并没有离开原来的“窝”,也就是在内存中,还是“旧”的,只不过里面的内容增多了。相当于两口之家,经过一番云雨之后,又增加了一个小宝宝,那么这个家是“新”的还是“旧”的呢?角度不同或许说法不一了。 - -这就是列表的一个**重要特征:列表是可以修改的。这种修改,不是复制一个新的,而是在原地进行修改。** - -其实,`append()`对列表的操作也是如此,不妨用同样的方式看看。 - -**说明:**虽然这里的lst内容和上面的一样,但是,我从新在shell中输入,所以id会变化。也就是内存分配的“窝”的编号变了。 - - >>> lst = ['python','qiwsir'] - >>> id(lst) - 3069501388L - >>> lst.append(new) - >>> lst - ['python', 'qiwsir', [1, 2, 3]] - >>> id(lst) - 3069501388L - -显然,`append()`也是原地修改列表。 - -如果,对于`extend()`,提供的不是iterable类型对象,会如何呢? - - >>> lst.extend("itdiffer") - >>> lst - ['python', 'qiwsir', 'i', 't', 'd', 'i', 'f', 'f', 'e', 'r'] - -它把一个字符串"itdiffer"转化为['i', 't', 'd', 'i', 'f', 'f', 'e', 'r'],然后将这个列表作为参数,提供给extend,并将列表中的元素塞入原来的列表中。 - - >>> num_lst = [1,2,3] - >>> num_lst.extend(8) - Traceback (most recent call last): - File "", line 1, in - TypeError: 'int' object is not iterable - -这就报错了。错误提示中告诉我们,那个数字8,是int类型的对象,不是iterable的。 - -这里讲述的两个让列表扩容的函数`append()`和`extend()`。从上面的演示中,可以看到他们有相同的地方: - -- 都是原地修改列表 -- 既然是原地修改,就不返回值 - -原地修改没有返回值,就不能赋值给某个变量。 - - >>> one = ["good","good","study"] - >>> another = one.extend(["day","day","up"]) #对于没有提供返回值的函数,如果要这样,结果是: - >>> another #这样的,什么也没有得到。 - >>> one - ['good', 'good', 'study', 'day', 'day', 'up'] - -那么两者有什么不一样呢?看下面例子: - - >>> lst = [1,2,3] - >>> lst.append(["qiwsir","github"]) - >>> lst - [1, 2, 3, ['qiwsir', 'github']] #append的结果 - >>> len(lst) - 4 - - >>> lst2 = [1,2,3] - >>> lst2.extend(["qiwsir","github"]) - >>> lst2 - [1, 2, 3, 'qiwsir', 'github'] #extend的结果 - >>> len(lst2) - 5 - -append是整建制地追加,extend是个体化扩编。 - -###count - -上面的len(L),可得到list的长度,也就是list中有多少个元素。python的list还有一个函数,就是数一数某个元素在该list中出现多少次,也就是某个元素有多少个。官方文档是这么说的: - ->list.count(x) - ->Return the number of times x appears in the list. - -一定要不断实验,才能理解文档中精炼的表达。 - - >>> la = [1,2,1,1,3] - >>> la.count(1) - 3 - >>> la.append('a') - >>> la.append('a') - >>> la - [1, 2, 1, 1, 3, 'a', 'a'] - >>> la.count('a') - 2 - >>> la.count(2) - 1 - >>> la.count(5) #NOTE:la中没有5,但是如果用这种方法找,不报错,返回的是数字0 - 0 - -###index - -[《列表(1)》](./111.md)中已经提到,这里不赘述,但是为了完整,也占个位置吧。 - - >>> la - [1, 2, 3, 'a', 'b', 'c', 'qiwsir', 'python'] - >>> la.index(3) - 2 - >>> la.index('qi') #如果不存在,就报错 - Traceback (most recent call last): - File "", line 1, in - ValueError: 'qi' is not in list - >>> la.index('qiwsir') - 6 - -list.index(x),x是list中的一个元素,这样就能够检索到该元素在list中的位置了。这才是真正的索引,注意那个英文单词index。 - -依然是上一条官方解释: - ->list.index(x) - ->Return the index in the list of the first item whose value is x. It is an error if there is no such item. - -是不是说的非常清楚明白了? - ------- - -[总目录](./index.md)   |   [上节:列表(1)](./111.md)   |   [下节:列表(3)](./113.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/113.md b/113.md deleted file mode 100644 index c453f4a..0000000 --- a/113.md +++ /dev/null @@ -1,234 +0,0 @@ ->"Come to me, all you that are weary and are carrying heavy burdens,and I will give you rest. Take my yoke upon you, and learn from me; for I am gentle and humble in heart, and you will find rest for your souls. For my yoke is easy, and my burden is light." (MATTHEW 21:28-30) - ->“凡劳苦担重担的人,可以到我这里来,我就使你们得安息。我心里柔和谦卑,你们当负我的轭,学我的样式,这样,你们心里就必得享安息。因为我的轭是容易的,我的担子是轻省的。” - -#列表(3) - -接着上节内容。下面是上节中说好要介绍的列表方法: - ->'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort' - -已经在上节讲解了前四个。 - -继续。 - -##list函数 - -###insert - -前面有向list中追加元素的方法,那个追加是且只能是将新元素添加在list的最后一个。如: - - >>> all_users = ["qiwsir","github"] - >>> all_users.append("io") - >>> all_users - ['qiwsir', 'github', 'io'] - -与`list.append(x)`类似,`list.insert(i,x)`也是对list元素的增加。只不过是可以在任何位置增加一个元素。 - -还是先看[官方文档来理解](https://docs.python.org/2/tutorial/datastructures.html): - ->list.insert(i, x) - -> Insert an item at a given position. The first argument is the index of the element before which to insert, so a.insert(0, x) inserts at the front of the list, and a.insert(len(a), x) is equivalent to a.append(x). - -这次就不翻译了。如果看不懂英语,怎么了解贵国呢?一定要硬着头皮看英语,不仅能够学好程序,更能...(此处省略两千字) - -根据官方文档的说明,我们做下面的实验,请看官从实验中理解: - - >>> all_users - ['qiwsir', 'github', 'io'] - >>> all_users.insert("python") - Traceback (most recent call last): - File "", line 1, in - TypeError: insert() takes exactly 2 arguments (1 given) - -请注意看报错的提示信息,`insert()`应该供给两个参数,但是这里只给了一个。所以报错没商量啦。 - - >>> all_users.insert(0,"python") - >>> all_users - ['python', 'qiwsir', 'github', 'io'] - - >>> all_users.insert(1,"http://") - >>> all_users - ['python', 'http://', 'qiwsir', 'github', 'io'] - -`list.insert(i, x)`中的i是将元素x插入到list中的位置,即将x插入到索引值是i的元素前面。注意,索引是从0开始的。 - -有一种操作,挺有意思的,如下: - - >>> length = len(all_users) - >>> length - 5 - >>> all_users.insert(length,"algorithm") - >>> all_users - ['python', 'http://', 'qiwsir', 'github', 'io', 'algorithm'] - -在all_users中,没有索引最大到4,如果要`all_users.insert(5,"algorithm")`,则表示将`"algorithm"`插入到索引值是5的前面,但是没有。换个说法,5前面就是4的后面。所以,就是追加了。 - -其实,还可以这样: - - >>> a = [1,2,3] - >>> a.insert(9,777) - >>> a - [1, 2, 3, 777] - -也就是说,如果遇到那个i已经超过了最大索引值,会自动将所要插入的元素放到列表的尾部,即追加。 - -###pop和remove - -list中的元素,不仅能增加,还能被删除。删除list元素的方法有两个,它们分别是: - ->list.remove(x) - -> Remove the first item from the list whose value is x. It is an error if there is no such item. - ->list.pop([i]) - -> Remove the item at the given position in the list, and return it. If no index is specified, a.pop() removes and returns the last item in the list. (The square brackets around the i in the method signature denote that the parameter is optional, not that you should type square brackets at that position. You will see this notation frequently in the Python Library Reference.) - -我这里讲授python,有一个习惯,就是用学习物理的方法。如果看官当初物理没有学好,那么一定是没有用这种方法,或者你的老师没有用这种教学法。这种方法就是:自己先实验,然后总结规律。 - -先实验list.remove(x),注意看上面的描述。这是一个能够删除list元素的方法,同时上面说明告诉我们,如果x没有在list中,会报错。 - - >>> all_users - ['python', 'http://', 'qiwsir', 'github', 'io', 'algorithm'] - >>> all_users.remove("http://") - >>> all_users #的确是把"http://"删除了 - ['python', 'qiwsir', 'github', 'io', 'algorithm'] - - >>> all_users.remove("tianchao") #原list中没有“tianchao”,要删除,就报错。 - Traceback (most recent call last): - File "", line 1, in - ValueError: list.remove(x): x not in list - - >>> lst = ["python","java","python","c"] - >>> lst.remove("python") - >>> lst - ['java', 'python', 'c'] - -重点解释一下第三个操作。哦,忘记一个提醒,我在前面的很多操作中,也都给列表的变量命名为lst,但是不是list,为什么呢?因为list是python的保留字。 - -还是继续第三段操作,列表中有两个'python'字符串,当删除后,发现结果只删除了第一个'python'字符串,第二个还在。请仔细看前面的文档说明:**remove the first item ...** - -注意两点: - -- 如果正确删除,不会有任何反馈。没有消息就是好消息。并且是对列表进行原地修改。 -- 如果所删除的内容不在list中,就报错。注意阅读报错信息:x not in list - ->什么是保留字?在python中,当然别的语言中也是如此啦。某些词语或者拼写是不能被用户拿来做变量/函数/类等命名,因为它们已经被语言本身先占用了。这些就是所谓保留字。在python中,以下是保留字,不能用于你自己变成中的任何命名。 - ->and, assert, break, class, continue, def, del, elif, else, except, exec, finally, for, from, global, if, import, in, is, lambda, not, or, pass, print, raise, return, try, while, wiht,yield - ->这些保留字,都是我们在编程中要用到的。有的你已经在前面遇到了。 - -看官是不是想到一个问题?如果能够在删除之前,先判断一下这个元素是不是在list中,如果在就删,不在就不删,不是更智能吗? - -如果看官想到这里,就是在编程的旅程上一进步。python的确让我们这么做。 - - >>> all_users - ['python', 'qiwsir', 'github', 'io', 'algorithm'] - >>> "python" in all_users #这里用in来判断一个元素是否在list中,在则返回True,否则返回False - True - - >>> if "python" in all_users: - ... all_users.remove("python") - ... print all_users - ... else: - ... print "'python' is not in all_users" - ... - ['qiwsir', 'github', 'io', 'algorithm'] #删除了"python"元素 - - >>> if "python" in all_users: - ... all_users.remove("python") - ... print all_users - ... else: - ... print "'python' is not in all_users" - ... - 'python' is not in all_users #因为已经删除了,所以就没有了。 - -上述代码,就是两段小程序,我是在交互模式中运行的,相当于小实验。这里其实用了一个后面才会降到的东西:if-else语句。不过,我觉得即使没有学习,你也能看懂,因为它非常接近自然语言了。 - -另外一个删除list.pop([i])会怎么样呢?看看文档,做做实验。 - - >>> all_users - ['qiwsir', 'github', 'io', 'algorithm'] - >>> all_users.pop() #list.pop([i]),圆括号里面是[i],表示这个序号是可选的 - 'algorithm' #如果不写,就如同这个操作,默认删除最后一个,并且将该结果返回 - - >>> all_users - ['qiwsir', 'github', 'io'] - - >>> all_users.pop(1) #指定删除编号为1的元素"github" - 'github' - - >>> all_users - ['qiwsir', 'io'] - >>> all_users.pop() - 'io' - - >>> all_users #只有一个元素了,该元素编号是0 - ['qiwsir'] - >>> all_users.pop(1) #但是非要删除编号为1的元素,结果报错。注意看报错信息 - Traceback (most recent call last): - File "", line 1, in - IndexError: pop index out of range #删除索引超出范围,就是1不在list的编号范围之内 - -简单总结一下,`list.remove(x)`中的参数是列表中元素,即删除某个元素;`list.pop([i])`中的i是列表中元素的索引值,这个i用放括号包裹起来,意味着还可以不写任何索引值,如上面操作结果,就是删除列表的最后一个。 - -给看官留下一个思考题,如果要像前面那样,能不能事先判断一下要删除的编号是不是在list的长度范围(用len(list)获取长度)以内?然后进行删除或者不删除操作。 - -###reverse - -reverse比较简单,就是把列表的元素顺序反过来。 - - >>> a = [3,5,1,6] - >>> a.reverse() - >>> a - [6, 1, 5, 3] - -注意,是原地反过来,不是另外生成一个新的列表。所以,它没有返回值。跟这个类似的有一个内建函数reversed,建议读者通过了解一下这个函数的使用方法。 - ->因为`list.reverse()`不返回值,所以不能实现对列表的反向迭代,如果要这么做,可以使用reversed函数。 - -###sort - -sort就是对列表进行排序。帮助文档中这么写的: - ->sort(...) - -> L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*; - cmp(x, y) -> -1, 0, 1 - - - >>> a = [6, 1, 5, 3] - >>> a.sort() - >>> a - [1, 3, 5, 6] - -`list.sort()`也是让列表进行原地修改,没有返回值。默认情况,如上面操作,实现的是从小到大的排序。 - - >>> a.sort(reverse=True) - >>> a - [6, 5, 3, 1] - -这样做,就实现了从大到小的排序。 - -在前面的函数说明中,还有一个参数key,这个怎么用呢?不知道看官是否用过电子表格,里面就是能够设置按照哪个关键字进行排序。这里也是如此。 - - >>> lst = ["python","java","c","pascal","basic"] - >>> lst.sort(key=len) - >>> lst - ['c', 'java', 'basic', 'python', 'pascal'] - -这是以字符串的长度为关键词进行排序。 - -对于排序,也有一个更为常用的内建函数sorted。 - -顺便指出,排序是一个非常有研究价值的话题。不仅仅是现在这么一个函数解决的。有兴趣的读者可以去网上搜一下排序相关知识。 - ------- - -[总目录](./index.md)   |   [上节:列表(2)](./112.md)   |   [下节:列表和字符串](./114.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 - diff --git a/114.md b/114.md deleted file mode 100644 index eff083d..0000000 --- a/114.md +++ /dev/null @@ -1,219 +0,0 @@ ->Then Peter came to him and said,"Lord, how many times must I forgive my brother who sins against me? As many as seven times?" Jesus said to him,"Not seven times, I tell you, but seventy-seven times?" (MATTHEW 18:21-22) - -#回顾list和str - -list和str两种类型数据,有不少相似的地方,也有很大的区别。本讲对她们做个简要比较,同时也是对前面有关两者的知识复习一下,所谓“温故而知新”。 - -##相同点 - -###都属于序列类型的数据 - -所谓序列类型的数据,就是说它的每一个元素都可以通过指定一个编号,行话叫做“偏移量”的方式得到,而要想一次得到多个元素,可以使用切片。偏移量从0开始,总元素数减1结束。 - -例如: - - >>> welcome_str = "Welcome you" - >>> welcome_str[0] - 'W' - >>> welcome_str[1] - 'e' - >>> welcome_str[len(welcome_str)-1] - 'u' - >>> welcome_str[:4] - 'Welc' - >>> a = "python" - >>> a*3 - 'pythonpythonpython' - - >>> git_list = ["qiwsir","github","io"] - >>> git_list[0] - 'qiwsir' - >>> git_list[len(git_list)-1] - 'io' - >>> git_list[0:2] - ['qiwsir', 'github'] - >>> b = ['qiwsir'] - >>> b*7 - ['qiwsir', 'qiwsir', 'qiwsir', 'qiwsir', 'qiwsir', 'qiwsir', 'qiwsir'] - -对于此类数据,下面一些操作是类似的: - - >>> first = "hello,world" - >>> welcome_str - 'Welcome you' - >>> first+","+welcome_str #用+号连接str - 'hello,world,Welcome you' - >>> welcome_str #原来的str没有受到影响,即上面的+号连接后从新生成了一个字符串 - 'Welcome you' - >>> first - 'hello,world' - - >>> language = ['python'] - >>> git_list - ['qiwsir', 'github', 'io'] - >>> language + git_list #用+号连接list,得到一个新的list - ['python', 'qiwsir', 'github', 'io'] - >>> git_list - ['qiwsir', 'github', 'io'] - >>> language - ['python'] - - >>> len(welcome_str) #得到字符数 - 11 - >>> len(git_list) #得到元素数 - 3 - -另外,前面的讲述中已经说明了关于序列的基本操作,此处不再重复。 - -##区别 - -list和str的最大区别是:list是可以改变的,str不可变。这个怎么理解呢? - -首先看对list的这些操作,其特点是在原处将list进行了修改: - - >>> git_list - ['qiwsir', 'github', 'io'] - - >>> git_list.append("python") - >>> git_list - ['qiwsir', 'github', 'io', 'python'] - - >>> git_list[1] - 'github' - >>> git_list[1] = 'github.com' - >>> git_list - ['qiwsir', 'github.com', 'io', 'python'] - - >>> git_list.insert(1,"algorithm") - >>> git_list - ['qiwsir', 'algorithm', 'github.com', 'io', 'python'] - - >>> git_list.pop() - 'python' - - >>> del git_list[1] - >>> git_list - ['qiwsir', 'github.com', 'io'] - -以上这些操作,如果用在str上,都会报错,比如: - - >>> welcome_str - 'Welcome you' - - >>> welcome_str[1]='E' - Traceback (most recent call last): - File "", line 1, in - TypeError: 'str' object does not support item assignment - - >>> del welcome_str[1] - Traceback (most recent call last): - File "", line 1, in - TypeError: 'str' object doesn't support item deletion - - >>> welcome_str.append("E") - Traceback (most recent call last): - File "", line 1, in - AttributeError: 'str' object has no attribute 'append' - -如果要修改一个str,不得不这样。 - - >>> welcome_str - 'Welcome you' - >>> welcome_str[0]+"E"+welcome_str[2:] #从新生成一个str - 'WElcome you' - >>> welcome_str #对原来的没有任何影响 - 'Welcome you' - -其实,在这种做法中,相当于从新生成了一个str。 - -##多维list - -这个也应该算是两者的区别了,虽然有点牵强。在str中,里面的每个元素只能是字符,在list中,元素可以是任何类型的数据。前面见的多是数字或者字符,其实还可以这样: - - >>> matrix = [[1,2,3],[4,5,6],[7,8,9]] - >>> matrix = [[1,2,3],[4,5,6],[7,8,9]] - >>> matrix[0][1] - 2 - >>> mult = [[1,2,3],['a','b','c'],'d','e'] - >>> mult - [[1, 2, 3], ['a', 'b', 'c'], 'd', 'e'] - >>> mult[1][1] - 'b' - >>> mult[2] - 'd' - -以上显示了多维list以及访问方式。在多维的情况下,里面的list也跟一个前面元素一样对待。 - -##list和str转化 - -以下涉及到的`split()`和`join()`在前面字符串部分已经见过。一回生,二回熟,这次再见面,特别是在已经学习了列表的基础上,应该有更深刻的理解。 - -###str.split() - -这个内置函数实现的是将str转化为list。其中str=""是分隔符。 - -在看例子之前,请看官在交互模式下做如下操作: - - >>>help(str.split) - -得到了对这个内置函数的完整说明。**特别强调:**这是一种非常好的学习方法 - ->split(...) ->S.split([sep [,maxsplit]]) -> list of strings - ->Return a list of the words in the string S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator and empty strings are removed from the result. - -不管是否看懂上面这段话,都可以看例子。还是希望看官能够理解上面的内容。 - - >>> line = "Hello.I am qiwsir.Welcome you." - - >>> line.split(".") #以英文的句点为分隔符,得到list - ['Hello', 'I am qiwsir', 'Welcome you', ''] - - >>> line.split(".",1) #这个1,就是表达了上文中的:If maxsplit is given, at most maxsplit splits are done. - ['Hello', 'I am qiwsir.Welcome you.'] - - >>> name = "Albert Ainstain" #也有可能用空格来做为分隔符 - >>> name.split(" ") - ['Albert', 'Ainstain'] - -下面的例子,让你更有点惊奇了。 - - >>> s = "I am, writing\npython\tbook on line" #这个字符串中有空格,逗号,换行\n,tab缩进\t 符号 - >>> print s #输出之后的样式 - I am, writing - python book on line - >>> s.split() #用split(),但是括号中不输入任何参数 - ['I', 'am,', 'writing', 'python', 'book', 'on', 'line'] - -如果split()不输入任何参数,显示就是见到任何分割符号,就用其分割了。 - -###"[sep]".join(list) - -join可以说是split的逆运算,举例: - - >>> name - ['Albert', 'Ainstain'] - >>> "".join(name) #将list中的元素连接起来,但是没有连接符,表示一个一个紧邻着 - 'AlbertAinstain' - >>> ".".join(name) #以英文的句点做为连接分隔符 - 'Albert.Ainstain' - >>> " ".join(name) #以空格做为连接的分隔符 - 'Albert Ainstain' - -回到上面那个神奇的例子中,可以这么使用join. - - >>> s = "I am, writing\npython\tbook on line" - >>> print s - I am, writing - python book on line - >>> s.split() - ['I', 'am,', 'writing', 'python', 'book', 'on', 'line'] - >>> " ".join(s.split()) #重新连接,不过有一点遗憾,am后面逗号还是有的。怎么去掉? - 'I am, writing python book on line' - ------- - -[总目录](./index.md)   |   [上节:列表(3)](./113.md)   |   [下节:元组](./115.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 diff --git a/115.md b/115.md deleted file mode 100644 index 2949c35..0000000 --- a/115.md +++ /dev/null @@ -1,118 +0,0 @@ ->“谁愿为首,就必作你们的仆人。正如人子来,不是要受人的服事,乃是要服事人,并且要舍命,作多人的赎价。”(MATTHEW 20:27-28) - -#元组 - -##定义 - -先看一个例子: - - >>>#变量引用str - >>> s = "abc" - >>> s - 'abc' - - >>>#如果这样写,就会是... - >>> t = 123,'abc',["come","here"] - >>> t - (123, 'abc', ['come', 'here']) - -上面例子中看到的变量t,并没有报错,也没有“最后一个有效”,而是将对象做为一个新的数据类型:tuple(元组),赋值给了变量t。 - -**元组是用圆括号括起来的,其中的元素之间用逗号隔开。(都是英文半角)** - -元组中的元素类型是任意的python数据。 - ->这种类型,可以歪着想,所谓“元”组,就是用“圆”括号啦。 - ->其实,你不应该对元组陌生,还记得前面讲述字符串的格式化输出时,有这样一种方式: - - >>> print "I love %s, and I am a %s" % ('python', 'programmer') - I love python, and I am a programmer - ->这里的圆括号,就是一个元组。 - -显然,tuple是一种序列类型的数据,这点上跟list/str类似。它的特点就是其中的元素不能更改,这点上跟list不同,倒是跟str类似;它的元素又可以是任何类型的数据,这点上跟list相同,但不同于str。 - - >>> t = 1,"23",[123,"abc"],("python","learn") #元素多样性,近list - >>> t - (1, '23', [123, 'abc'], ('python', 'learn')) - - >>> t[0] = 8  #不能原地修改,近str - Traceback (most recent call last): - File "", line 1, in - TypeError: 'tuple' object does not support item assignment - - >>> t.append("no") - Traceback (most recent call last): - File "", line 1, in - AttributeError: 'tuple' object has no attribute 'append' - >>> - -从上面的简单比较似乎可以认为,tuple就是一个融合了部分list和部分str属性的杂交产物。此言有理。 - -##索引和切片 - -因为前面有了关于列表和字符串的知识,它们都是序列类型,元组也是。因此,元组的基本操作就和它们是一样的。 - -例如: - - >>> t - (1, '23', [123, 'abc'], ('python', 'learn')) - >>> t[2] - [123, 'abc'] - >>> t[1:] - ('23', [123, 'abc'], ('python', 'learn')) - - >>> t[2][0] #还能这样呀,哦对了,list中也能这样 - 123 - >>> t[3][1] - 'learn' - -关于序列的基本操作在tuple上的表现,就不一一展示了。看官可以去试试。 - -但是这里要特别提醒,如果一个元组中只有一个元素的时候,应该在该元素后面加一个半角的英文逗号。 - - >>> a = (3) - >>> type(a) - - - >>> b = (3,) - >>> type(b) - - -以上面的例子说明,如果不加那个逗号,就不是元组,加了才是。这也是为了避免让python误解你要表达的内容。 - -顺便补充:如果要想看一个对象是什么类型,可以使用`type()`函数,然后就返回该对象的类型。 - -**所有在list中可以修改list的方法,在tuple中,都失效。** - -分别用list()和tuple()能够实现两者的转化: - - >>> t - (1, '23', [123, 'abc'], ('python', 'learn')) - >>> tls = list(t) #tuple-->list - >>> tls - [1, '23', [123, 'abc'], ('python', 'learn')] - - >>> t_tuple = tuple(tls) #list-->tuple - >>> t_tuple - (1, '23', [123, 'abc'], ('python', 'learn')) - -##tuple用在哪里? - -既然它是list和str的杂合,它有什么用途呢?不是用list和str都可以了吗? - -在很多时候,的确是用list和str都可以了。但是,看官不要忘记,我们用计算机语言解决的问题不都是简单问题,就如同我们的自然语言一样,虽然有的词汇看似可有可无,用别的也能替换之,但是我们依然需要在某些情况下使用它们. - -一般认为,tuple有这类特点,并且也是它使用的情景: - -- Tuple 比 list 操作速度快。如果您定义了一个值的常量集,并且唯一要用它做的是不断地遍历它,请使用 tuple 代替 list。 -- 如果对不需要修改的数据进行 “写保护”,可以使代码更安全。使用 tuple 而不是 list 如同拥有一个隐含的 assert 语句,说明这一数据是常量。如果必须要改变这些值,则需要执行 tuple 到 list 的转换 (需要使用一个特殊的函数)。 -- Tuples 可以在 dictionary(字典,后面要讲述) 中被用做 key,但是 list 不行。Dictionary key 必须是不可变的。Tuple 本身是不可改变的,但是如果您有一个 list 的 tuple,那就认为是可变的了,用做 dictionary key 就是不安全的。只有字符串、整数或其它对 dictionary 安全的 tuple 才可以用作 dictionary key。 -- Tuples 可以用在字符串格式化中。 - ------- - -[总目录](./index.md)   |   [上节:回顾list和str](./114.md)   |   [下节:字典(1)](./116.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 diff --git a/116.md b/116.md deleted file mode 100644 index 0e1f14c..0000000 --- a/116.md +++ /dev/null @@ -1,245 +0,0 @@ -#字典(1) - -字典,这个东西你现在还用吗?随着网络的发展,用的人越来越少了。不少人习惯于在网上搜索,不仅有web版,乃至于已经有手机版的各种字典了。我在上小学的时候曾经用过一本小小的《新华字典》,记得是拾了不少废品,然后换钱,最终花费了1.01元人民币买的。 - ->《新华字典》是中国第一部现代汉语字典。最早的名字叫《伍记小字典》,但未能编纂完成。自1953年,开始重编,其凡例完全采用《伍记小字典》。从1953年开始出版,经过反复修订,但是以1957年商务印书馆出版的《新华字典》作为第一版。原由新华辞书社编写,1956年并入中科院语言研究所(现中国社科院语言研究所)词典编辑室。新华字典由商务印书馆出版。历经几代上百名专家学者10余次大规模的修订,重印200多次。成为迄今为止世界出版史上最高发行量的字典。 - -这里讲到字典,不是为了回忆青葱岁月。而是提醒看官想想我们如何使用字典:先查索引(不管是拼音还是偏旁查字),然后通过索引找到相应内容。不用从头开始一页一页地找。 - -这种方法能够快捷的找到目标。 - -正是基于这种需要,python中有了一种叫做dictionary的数据类型,翻译过来就是“字典”,用dict表示。 - -假设一种需要,要存储城市和电话区号,苏州的区号是0512,唐山的是0315,北京的是011,上海的是012。用前面已经学习过的知识,可以这么来做: - - >>> citys = ["suzhou", "tangshan", "beijing", "shanghai"] - >>> city_codes = ["0512", "0315", "011", "012"] - -用一个列表来存储城市名称,然后用另外一个列表,一一对应地保存区号。假如要输出苏州的区号,可以这么做: - - >>> print "{} : {}".format(citys[0], city_codes[0]) - suzhou : 0512 - ->请特别注意,我在city_codes中,表示区号的元素没有用整数型,而是使用了字符串类型,你知道为什么吗? ->如果用整数,就是这样的。 - - >>> suzhou_code = 0512 - >>> print suzhou_code - 330 - ->怎么会这样?原来在python中,如果按照上面那样做,0512并没有被认为是一个八进制的数,用print打印的时候,将它转换为了十进制输出。关于进制转换问题,看官可以网上搜索一下有关资料。此处不详述。一般是用几个内建函数实现:`int()`, `bin()`, `oct()`, `hex()` - -这样来看,用两个列表分别来存储城市和区号,似乎能够解决问题。但是,这不是最好的选择,至少在python里面。因为python还提供了另外一种方案,那就是字典(dict)。 - -##创建dict - -**方法1:** - -创建一个空的dict,这个空dict,可以在以后向里面加东西用。 - - >>> mydict = {} - >>> mydict - {} - -不要小看“空”,“色即是空,空即是色”,在编程中,“空”是很重要。一般带“空”字的人都很有名,比如孙悟空,哦。好像他应该是猴、或者是神。举一个人的名字,带“空”字,你懂得。 - -创建有内容的dict。 - - >>> person = {"name":"qiwsir","site":"qiwsir.github.io","language":"python"} - >>> person - {'name': 'qiwsir', 'language': 'python', 'site': 'qiwsir.github.io'} - -`"name":"qiwsir"`,有一个优雅的名字:键值对。前面的name叫做键(key),后面的qiwsir是前面的键所对应的值(value)。在一个dict中,键是唯一的,不能重复。值则是对应于键,值可以重复。键值之间用(:)英文的分号,每一对键值之间用英文的逗号(,)隔开。 - - >>> person['name2']="qiwsir" #这是一种向dict中增加键值对的方法 - >>> person - {'name2': 'qiwsir', 'name': 'qiwsir', 'language': 'python', 'site': 'qiwsir.github.io'} - -用这样的方法可以向一个dict类型的数据中增加“键值对”,也可以说是增加数值。那么,增加了值之后,那个字典还是原来的吗?也就是也要同样探讨一下,字典是否能原地修改?(列表可以,所以列表是可变的;字符串和元组都不行,所以它们是不可变的。) - - >>> ad = {} - >>> id(ad) - 3072770636L - >>> ad["name"] = "qiwsir" - >>> ad - {'name': 'qiwsir'} - >>> id(ad) - 3072770636L - -实验表明,字典可以原地修改,即它是可变的。 - -**方法2:** - -利用元组在建构字典,方法如下: - - >>> name = (["first","Google"],["second","Yahoo"]) - >>> website = dict(name) - >>> website - {'second': 'Yahoo', 'first': 'Google'} - -或者用这样的方法: - - >>> ad = dict(name="qiwsir", age=42) - >>> ad - {'age': 42, 'name': 'qiwsir'} - -**方法3:** - -这个方法,跟上面的不同在于使用fromkeys - - >>> website = {}.fromkeys(("third","forth"),"facebook") - >>> website - {'forth': 'facebook', 'third': 'facebook'} - -需要提醒的是,这种方法是从新建立一个dict。 - -需要提醒注意的是,在字典中的“键”,必须是不可变的数据类型;“值”可以是任意数据类型。 - - >>> dd = {(1,2):1} - >>> dd - {(1, 2): 1} - >>> dd = {[1,2]:1} - Traceback (most recent call last): - File "", line 1, in - TypeError: unhashable type: 'list' - -##访问dict的值 - -dict数据类型是以键值对的形式存储数据的,所以,只要知道键,就能得到值。这本质上就是一种映射关系。 - ->映射,就好比“物体”和“影子”的关系,“形影相吊”,两者之间是映射关系。此外,映射也是一个严格数学概念:A是非空集合,A到B的映射是指:A中每个元素都对应到B中的某个元素。 - -既然是映射,就可以通过字典的“键”找到相应的“值”。 - - >>> person - {'name2': 'qiwsir', 'name': 'qiwsir', 'language': 'python', 'site': 'qiwsir.github.io'} - >>> person['name'] - 'qiwsir' - >>> person['language'] - 'python' - -如同前面所讲,通过“键”能够增加dict中的“值”,通过“键”能够改变dict中的“值”,通过“键”也能够访问dict中的“值”。 - -本节开头那个城市和区号的关系,也可以用字典来存储和读取。 - - >>> city_code = {"suzhou":"0512", "tangshan":"0315", "beijing":"011", "shanghai":"012"} - >>> print city_code["suzhou"] - 0512 - -既然dict是键值对的映射,就不用考虑所谓“排序”问题了,只要通过键就能找到值,至于这个键值对位置在哪里就不用考虑了。比如,刚才建立的city_code - - >>> city_code - {'suzhou': '0512', 'beijing': '011', 'shanghai': '012', 'tangshan': '0315'} - -虽然这里显示的和刚刚赋值的时候顺序有别,但是不影响读取其中的值。 - -在list中,得到值是用索引的方法。那么在字典中有索引吗?当然没有,因为它没有顺序,哪里来的索引呢?所以,在字典中就不要什么索引和切片了。 - ->dict中的这类以键值对的映射方式存储数据,是一种非常高效的方法,比如要读取值得时候,如果用列表,python需要从头开始读,直到找到指定的那个索引值。但是,在dict中是通过“键”来得到值。要高效得多。 ->正是这个特点,键值对这样的形式可以用来存储大规模的数据,因为检索快捷。规模越大越明显。所以,mongdb这种非关系型数据库在大数据方面比较流行了。 - -##基本操作 - -字典虽然跟列表有很大的区别,但是依然有不少类似的地方。它的基本操作: - -- len(d),返回字典(d)中的键值对的数量 -- d[key],返回字典(d)中的键(key)的值 -- d[key]=value,将值(value)赋给字典(d)中的键(key) -- del d[key],删除字典(d)的键(key)项(将该键值对删除) -- key in d,检查字典(d)中是否含有键为key的项 - -下面依次进行演示。 - - >>> city_code - {'suzhou': '0512', 'beijing': '011', 'shanghai': '012', 'tangshan': '0315'} - >>> len(city_code) - 4 - -以city_code为操作对象,len(city_code)的值是4,表明有四组键值对,也可以说是四项。 - - >>> city_code["nanjing"] = "025" - >>> city_code - {'suzhou': '0512', 'beijing': '011', 'shanghai': '012', 'tangshan': '0315', 'nanjing': '025'} - -向其中增加一项 - - >>> city_code["beijing"] = "010" - >>> city_code - {'suzhou': '0512', 'beijing': '010', 'shanghai': '012', 'tangshan': '0315', 'nanjing': '025'} - -突然发现北京的区号写错了。可以这样修改。这进一步说明字典是可变的。 - - >>> city_code["shanghai"] - '012' - >>> del city_code["shanghai"] - -通过`city_code["shanghai"]`能够查看到该键(key)所对应的值(value),结果发现也错了。干脆删除,用del,将那一项都删掉。 - - >>> city_code["shanghai"] - Traceback (most recent call last): - File "", line 1, in - KeyError: 'shanghai' - >>> "shanghai" in city_code - False - -因为键是"shanghai"的那个键值对项已经删除了,随意不能找到,用`in`来看看,返回的是`False`。 - - >>> city_code - {'suzhou': '0512', 'beijing': '010', 'tangshan': '0315', 'nanjing': '025'} - -真的删除了哦。没有了。 - -##字符串格式化输出 - -这是一个前面已经探讨过的话题,请参看[《字符串(4)》](./109),这里再次提到,就是因为用字典也可以实现格式化字符串的目的。虽然在《字符串(4)》那节中已经有了简单演示,但是我还是愿意重复一下。 - - >>> city_code = {"suzhou":"0512", "tangshan":"0315", "hangzhou":"0571"} - >>> " Suzhou is a beautiful city, its area code is %(suzhou)s" % city_code - ' Suzhou is a beautiful city, its area code is 0512' - -这种写法是非常简洁,而且很有意思的。有人说它简直是酷。 - -其实,更酷还是下面的——模板 - -在做网页开发的时候,通常要用到模板,也就是你只需要写好HTML代码,然后将某些部位空出来,等着python后台提供相应的数据即可。当然,下面所演示的是玩具代码,基本没有什么使用价值,因为在真是的网站开发中,这样的姿势很少用上。但是,它绝非花拳绣腿,而是你能够明了其本质,至少了解到一种格式化方法的应用。 - - >>> temp = "%(lang)s<title><body><p>My name is %(name)s.</p></body></head></html>" - >>> my = {"name":"qiwsir", "lang":"python"} - >>> temp % my - '<html><head><title>python<title><body><p>My name is qiwsir.</p></body></head></html>' - -temp就是所谓的模板,在双引号所包裹的实质上是一段HTML代码。然后在dict中写好一些数据,按照模板的要求在相应位置显示对应的数据。 - -是不是一个很有意思的屠龙之技? - ->什么是HTML? 下面是在《维基百科》上抄录的: - ->超文本标记语言(英文:HyperText Markup Language,HTML)是为「网页创建和其它可在网页浏览器中看到的信息」设计的一种标记语言。HTML被用来结构化信息——例如标题、段落和列表等等,也可用来在一定程度上描述文档的外观和语义。1982年由蒂姆·伯纳斯-李创建,由IETF用简化的SGML(标准通用标记语言)语法进行进一步发展的HTML,后来成为国际标准,由万维网联盟(W3C)维护。 - ->HTML经过发展,现在已经到HTML5了。现在的HTML设计,更强调“响应式”设计,就是能够兼顾PC、手机和各种PAD的不同尺寸的显示器浏览。如果要开发一个网站,一定要做到“响应式”设计,否则就只能在PC上看,在手机上看就不得不左右移动。 - -##知识 - -什么是关联数组?以下解释来自[维基百科](http://zh.wikipedia.org/wiki/%E5%85%B3%E8%81%94%E6%95%B0%E7%BB%84) - ->在计算机科学中,关联数组(英语:Associative Array),又称映射(Map)、字典(Dictionary)是一个抽象的数据结构,它包含着类似于(键,值)的有序对。一个关联数组中的有序对可以重复(如C++中的multimap)也可以不重复(如C++中的map)。 - ->这种数据结构包含以下几种常见的操作: ->>1.向关联数组添加配对 ->>2.从关联数组内删除配对 ->>3.修改关联数组内的配对 ->>4.根据已知的键寻找配对 - ->字典问题是设计一种能够具备关联数组特性的数据结构。解决字典问题的常用方法,是利用散列表,但有些情况下,也可以直接使用有地址的数组,或二叉树,和其他结构。 - ->许多程序设计语言内置基本的数据类型,提供对关联数组的支持。而Content-addressable memory则是硬件层面上实现对关联数组的支持。 - -什么是哈希表?关于哈希表的叙述比较多,这里仅仅截取了概念描述,更多的可以到[维基百科上阅读](http://zh.wikipedia.org/wiki/%E5%93%88%E5%B8%8C%E8%A1%A8)。 - ->散列表(Hash table,也叫哈希表),是根据关键字(Key value)而直接访问在内存存储位置的数据结构。也就是说,它通过把键值通过一个函数的计算,映射到表中一个位置来访问记录,这加快了查找速度。这个映射函数称做散列函数,存放记录的数组称做散列表。 - ------- - -[总目录](./index.md)   |   [上节:元组](./115.md)   |   [下节:字典(2)](./117.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/117.md b/117.md deleted file mode 100644 index a077f29..0000000 --- a/117.md +++ /dev/null @@ -1,440 +0,0 @@ ->耶稣对他说:“你要尽心、尽性、尽意,爱主你的神。这是诫命中的第一,且是最大的。其次也相仿,就是要爱人如己。这两条诫命是律法和先知一切道理的总纲。”(MATTHEW 22:37-39) - -#字典(2) - -##字典方法 - -跟前面所讲述的其它数据类型类似,字典也有一些方法。通过这些方法,能够实现对字典类型数据的操作。这回可不是屠龙之技的。这些方法在编程实践中经常会用到。 - -###copy - -拷贝,这个汉语是copy的音译,标准的汉语翻译是“复制”。我还记得当初在学DOS的时候,那个老师说“拷贝”,搞得我晕头转向,他没有说引文的“copy”发音,而是用标准汉语说“kao(三声)bei(四声)”,对于一直学习过英语、标准汉语和我家乡方言的人来说,理解“拷贝”是有点困难的。谁知道在编程界用的是音译呢。 - -在一般的理解中,copy就是将原来的东西再搞一份。但是,在python里面(乃至于很多编程语言中),copy可不是那么简单的。 - - >>> a = 5 - >>> b = a - >>> b - 5 - -这样做,是不是就得到了两个5了呢?表面上看似乎是,但是,不要忘记我在前面反复提到的:**对象有类型,变量无类型**,正是因着这句话,变量其实是一个标签。不妨请出法宝:`id()`,专门查看内存中对象编号 - - >>> id(a) - 139774080 - >>> id(b) - 139774080 - -果然,并没有两个5,就一个,只不过是贴了两张标签而已。这种现象普遍存在于python的多种数据类型中。其它的就不演示了,就仅看看dict类型。 - - >>> ad = {"name":"qiwsir", "lang":"python"} - >>> bd = ad - >>> bd - {'lang': 'python', 'name': 'qiwsir'} - >>> id(ad) - 3072239652L - >>> id(bd) - 3072239652L - -是的,验证了。的确是一个对象贴了两个标签。这是用赋值的方式,实现的所谓“假装拷贝”。那么如果用copy方法呢? - - >>> cd = ad.copy() - >>> cd - {'lang': 'python', 'name': 'qiwsir'} - >>> id(cd) - 3072239788L - -果然不同,这次得到的cd是跟原来的ad不同的,它在内存中另辟了一个空间。如果我尝试修改cd,就应该对原来的ad不会造成任何影响。 - - >>> cd["name"] = "itdiffer.com" - >>> cd - {'lang': 'python', 'name': 'itdiffer.com'} - >>> ad - {'lang': 'python', 'name': 'qiwsir'} - -真的是那样,跟推理一模一样。所以,要理解了“变量”是对象的标签,对象有类型而变量无类型,就能正确推断出python能够提供的结果。 - - >>> bd - {'lang': 'python', 'name': 'qiwsir'} - >>> bd["name"] = "laoqi" - >>> ad - {'lang': 'python', 'name': 'laoqi'} - >>> bd - {'lang': 'python', 'name': 'laoqi'} - -这是又修改了bd所对应的“对象”,结果发现ad的“对象”也变了。 - -然而,事情没有那么简单,看下面的,要仔细点,否则就迷茫了。 - - >>> x = {"name":"qiwsir", "lang":["python", "java", "c"]} - >>> y = x.copy() - >>> y - {'lang': ['python', 'java', 'c'], 'name': 'qiwsir'} - >>> id(x) - 3072241012L - >>> id(y) - 3072241284L - -y是从x拷贝过来的,两个在内存中是不同的对象。 - - >>> y["lang"].remove("c") - -为了便于理解,尽量使用短句子,避免用很长很长的复合句。在y所对应的dict对象中,键"lang"的值是一个列表,为['python', 'java', 'c'],这里用`remove()`这个列表方法删除其中的一个元素"c"。删除之后,这个列表变为:['python', 'java'] - - >>> y - {'lang': ['python', 'java'], 'name': 'qiwsir'} - -果然不出所料。那么,那个x所对应的字典中,这个列表变化了吗?应该没有变化。因为按照前面所讲的,它是另外一个对象,两个互不干扰。 - - >>> x - {'lang': ['python', 'java'], 'name': 'qiwsir'} - -是不是有点出乎意料呢?我没有作弊哦。你如果不信,就按照操作自己在交互模式中试试,是不是能够得到这个结果呢?这是为什么? - -但是,如果要操作另外一个键值对: - - >>> y["name"] = "laoqi" - >>> y - {'lang': ['python', 'java'], 'name': 'laoqi'} - >>> x - {'lang': ['python', 'java'], 'name': 'qiwsir'} - -前面所说的原理是有效的,为什么到值是列表的时候就不奏效了呢? - -要破解这个迷局还得用`id()` - - >>> id(x) - 3072241012L - >>> id(y) - 3072241284L - -x,y对应着两个不同对象,的确如此。但这个对象(字典)是由两个键值对组成的。其中一个键的值是列表。 - - >>> id(x["lang"]) - 3072243276L - >>> id(y["lang"]) - 3072243276L - -发现了这样一个事实,列表是同一个对象。 - -但是,作为字符串为值得那个键值对,是分属不同对象。 - - >>> id(x["name"]) - 3072245184L - >>> id(y["name"]) - 3072245408L - -这个事实,就说明了为什么修改一个列表,另外一个也跟着修改;而修改一个的字符串,另外一个不跟随的原因了。 - -但是,似乎还没有解开深层的原因。深层的原因,是跟python存储的数据类型特点有关,python只存储基本类型的数据,比如int,str,对于不是基础类型的,比如刚才字典的值是列表,python不会在被复制的那个对象中从新存储,而是用引用的方式,指向原来的值。如果读者没有明白这句话的意思,我就只能说点通俗的了(我本来不想说通俗的,装着自己有学问),python在所执行的复制动作中,如果是基本类型的数据,就在内存中从新建个窝,如果不是基本类型的,就不新建窝了,而是用标签引用原来的窝。这也好理解,如果比较简单,随便建立新窝简单;但是,如果对象太复杂了,就别费劲了,还是引用一下原来的省事。(这么讲有点忽悠了)。 - -所以,在编程语言中,把实现上面那种拷贝的方式称之为“浅拷贝”。顾名思义,没有解决深层次问题。言外之意,还有能够解决深层次问题的方法喽。 - -的确是,在python中,有一个“深拷贝”(deep copy)。不过,要用下一`import`来导入一个模块。这个东西后面会讲述,前面也遇到过了。 - - >>> import copy - >>> z = copy.deepcopy(x) - >>> z - {'lang': ['python', 'java'], 'name': 'qiwsir'} - -用`copy.deepcopy()`深拷贝了一个新的副本,看这个函数的名字就知道是深拷贝(deepcopy)。用上面用过的武器id()来勘察一番: - - >>> id(x["lang"]) - 3072243276L - >>> id(z["lang"]) - 3072245068L - -果然是另外一个“窝”,不是引用了。如果按照这个结果,修改其中一个列表中的元素,应该不影响另外一个了。 - - >>> x - {'lang': ['python', 'java'], 'name': 'qiwsir'} - >>> x["lang"].remove("java") - >>> x - {'lang': ['python'], 'name': 'qiwsir'} - >>> z - {'lang': ['python', 'java'], 'name': 'qiwsir'} - -果然如此。再试试,才过瘾呀。 - - >>> x["lang"].append("c++") - >>> x - {'lang': ['python', 'c++'], 'name': 'qiwsir'} - -这就是所谓浅拷贝和深拷贝。 - -###clear - -在交互模式中,用help是一个很好的习惯 - - >>> help(dict.clear) - - clear(...) - D.clear() -> None. Remove all items from D. - -这是一个清空字典中所有元素的操作。 - - >>> a = {"name":"qiwsir"} - >>> a.clear() - >>> a - {} - -这就是`clear`的含义,将字典清空,得到的是“空”字典。这个上节说的`del`有着很大的区别。`del`是将字典删除,内存中就没有它了,不是为“空”。 - - >>> del a - >>> a - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - NameError: name 'a' is not defined - -果然删除了。 - -另外,如果要清空一个字典,还能够使用`a = {}`这种方法,但这种方法本质是将变量a转向了`{}`这个对象,那么原来的呢?原来的成为了断线的风筝。这样的东西在python中称之为垃圾,而且python能够自动的将这样的垃圾回收。编程者就不用关心它了,反正python会处理了。 - -###get,setdefault - -get的含义是: - - get(...) - D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None. - -注意这个说明中,“if k in D”,就返回其值,否则...(等会再说)。 - - >>> d - {'lang': 'python'} - >>> d.get("lang") - 'python' - -`dict.get()`就是要得到字典中某个键的值,不过,它不是那么“严厉”罢了。因为类似获得字典中键的值得方法,上节已经有过,如`d['lang']`就能得到对应的值`"python"`,可是,如果要获取的键不存在,如: - - >>> print d.get("name") - None - - >>> d["name"] - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - KeyError: 'name' - -这就是`dict.get()`和`dict['key']`的区别。 - -前面有一个半句话,如果键不在字典中,会返回None,这是一种情况。还可以这样: - - >>> d = {"lang":"python"} - >>> newd = d.get("name",'qiwsir') - >>> newd - 'qiwsir' - >>> d - {'lang': 'python'} - -以`d.get("name",'qiwsir')`的方式,如果不能得到键"name"的值,就返回后面指定的值"qiwsir"。这就是文档中那句话:`D[k] if k in D, else d.`的含义。这样做,并没有影响原来的字典。 - -另外一个跟get在功能上有相似地方的`D.setdefault(k)`,其含义是: - - setdefault(...) - D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D - -首先,它要执行`D.get(k,d)`,就跟前面一样了,然后,进一步执行另外一个操作,如果键k不在字典中,就在字典中增加这个键值对。当然,如果有就没有必要执行这一步了。 - - >>> d - {'lang': 'python'} - >>> d.setdefault("lang") - 'python' - -在字典中,有"lang"这个键,那么就返回它的值。 - - >>> d.setdefault("name","qiwsir") - 'qiwsir' - >>> d - {'lang': 'python', 'name': 'qiwsir'} - -没有"name"这个键,于是返回`d.setdefault("name","qiwsir")`指定的值"qiwsir",并且将键值对`'name':"qiwsir"`添加到原来的字典中。 - -如果这样操作: - - >>> d.setdefault("web") - -什么也没有返回吗?不是,返回了,只不过没有显示出来,如果你用print就能看到了。因为这里返回的是一个None.不妨查看一下那个字典。 - - >>> d - {'lang': 'python', 'web': None, 'name': 'qiwsir'} - -是不是键"web"的值成为了None - - -###items/iteritems, keys/iterkeys, values/itervalues - -这个标题中列出的是三组dict的函数,并且这三组有相似的地方。在这里详细讲述第一组,其余两组,我想凭借读者的聪明智慧是不在话下的。 - - >>> help(dict.items) - - items(...) - D.items() -> list of D's (key, value) pairs, as 2-tuples - -这种方法是惯用的伎俩了,只要在交互模式中鼓捣一下,就能得到帮助信息。从中就知道`D.items()`能够得到一个关于字典的列表,列表中的元素是由字典中的键和值组成的元组。例如: - - >>> dd = {"name":"qiwsir", "lang":"python", "web":"www.itdiffer.com"} - >>> dd_kv = dd.items() - >>> dd_kv - [('lang', 'python'), ('web', 'www.itdiffer.com'), ('name', 'qiwsir')] - -显然,是有返回值的。这个操作,在后面要讲到的循环中,将有很大的作用。 - -跟`items`类似的就是`iteritems`,看这个词的特点,是由iter和items拼接而成的,后部分items就不用说了,肯定是在告诉我们,得到的结果跟`D.items()`的结果类似。是的,但是,还有一个iter是什么意思?在[《列表(2)](./112.md)中,我提到了一个词“iterable”,它的含义是“可迭代的”,这里的iter是指的名词iterator的前部分,意思是“迭代器”。合起来,"iteritems"的含义就是: - - iteritems(...) - D.iteritems() -> an iterator over the (key, value) items of D - -你看,学习python不是什么难事,只要充分使用帮助文档就好了。这里告诉我们,得到的是一个“迭代器”(关于什么是迭代器,以及相关的内容,后续会详细讲述),这个迭代器是关于“D.items()”的。看个例子就明白了。 - - >>> dd - {'lang': 'python', 'web': 'www.itdiffer.com', 'name': 'qiwsir'} - >>> dd_iter = dd.iteritems() - >>> type(dd_iter) - <type 'dictionary-itemiterator'> - >>> dd_iter - <dictionary-itemiterator object at 0xb72b9a2c> - >>> list(dd_iter) - [('lang', 'python'), ('web', 'www.itdiffer.com'), ('name', 'qiwsir')] - -得到的dd_iter的类型,是一个'dictionary-itemiterator'类型,不过这种迭代器类型的数据不能直接输出,必须用`list()`转换一下,才能看到里面的真面目。 - -另外两组,含义跟这个相似,只不过是得到key或者value。下面仅列举一下例子,具体内容,读者可以自行在交互模式中看文档。 - - >>> dd - {'lang': 'python', 'web': 'www.itdiffer.com', 'name': 'qiwsir'} - >>> dd.keys() - ['lang', 'web', 'name'] - >>> dd.values() - ['python', 'www.itdiffer.com', 'qiwsir'] - -这里先交代一句,如果要实现对键值对或者键或者值的循环,用迭代器的效率会高一些。对这句话的理解,在后面会给大家进行详细分析。 - -###pop, popitem - -在[《列表(3)》](./113.md)中,有关于删除列表中元素的函数`pop`和`remove`,这两个的区别在于`list.remove(x)`用来删除指定的元素,而`list.pop([i])`用于删除指定索引的元素,如果不提供索引值,就默认删除最后一个。 - -在字典中,也有删除键值对的函数。 - - pop(...) - D.pop(k[,d]) -> v, remove specified key and return the corresponding value. - If key is not found, d is returned if given, otherwise KeyError is raised - -`D.pop(k[,d])`是以字典的键为参数,删除指定键的键值对,当然,如果输入对应的值有可以,那个是可选的。 - - >>> dd - {'lang': 'python', 'web': 'www.itdiffer.com', 'name': 'qiwsir'} - >>> dd.pop("name") - 'qiwsir' - -要删除指定键"name",返回了其值"qiwsir"。这样,在原字典中,“'name':'qiwsir'”这个键值对就被删除了。 - - >>> dd - {'lang': 'python', 'web': 'www.itdiffer.com'} - -值得注意的是,pop函数中的参数是不能省略的,这跟列表中的那个pop有所不同。 - - >>> dd.pop() - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - TypeError: pop expected at least 1 arguments, got 0 - -如果要删除字典中没有的键值对,也会报错。 - - >>> dd.pop("name") - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - KeyError: 'name' - -有意思的是`D.popitem()`倒是跟`list.pop()`有相似之处,不用写参数(list.pop是可以不写参数),但是,`D.popitem()`不是删除最后一个,前面已经交代过了,dict没有顺序,也就没有最后和最先了,它是随机删除一个,并将所删除的返回。 - - popitem(...) - D.popitem() -> (k, v), remove and return some (key, value) pair as a - 2-tuple; but raise KeyError if D is empty. - -如果字典是空的,就要报错了 - - >>> dd - {'lang': 'python', 'web': 'www.itdiffer.com'} - >>> dd.popitem() - ('lang', 'python') - >>> dd - {'web': 'www.itdiffer.com'} - -成功地删除了一对,注意是随机的,不是删除前面显示的最后一个。并且返回了删除的内容,返回的数据格式是tuple - - >>> dd.popitems() - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - AttributeError: 'dict' object has no attribute 'popitems' - -错了?!注意看提示信息,没有那个...,哦,果然错了。注意是popitem,不要多了s,前面的`D.items()`中包含s,是复数形式,说明它能够返回多个结果(多个元组组成的列表),而在`D.popitem()`中,一次只能随机删除一对键值对,并以一个元组的形式返回,所以,要单数形式,不能用复数形式了。 - - >>> dd.popitem() - ('web', 'www.itdiffer.com') - >>> dd - {} - -都删了,现在那个字典成空的了。如果再删,会怎么样? - - >>> dd.popitem() - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - KeyError: 'popitem(): dictionary is empty' - -报错信息中明确告知,字典已经是空的了,没有再供删的东西了。 - -###update - -`update()`,看名字就猜测到一二了,不是更新字典内容呢?的确是。 - - update(...) - D.update([E, ]**F) -> None. Update D from dict/iterable E and F. - If E present and has a .keys() method, does: for k in E: D[k] = E[k] - If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v - In either case, this is followed by: for k in F: D[k] = F[k] - -不过,看样子这个函数有点复杂。不要着急,通过实验可以一点一点鼓捣明白的。 - -首先,这个函数没有返回值,或者说返回值是None,它的作用就是更新字典。其参数可以是字典或者某种可迭代的数据类型。 - - >>> d1 = {"lang":"python"} - >>> d2 = {"song":"I dreamed a dream"} - >>> d1.update(d2) - >>> d1 - {'lang': 'python', 'song': 'I dreamed a dream'} - >>> d2 - {'song': 'I dreamed a dream'} - -这样就把字典d2更新入了d1那个字典,于是d1中就多了一些内容,把d2的内容包含进来了。d2当然还存在,并没有受到影响。 - -还可以用下面的方法更新: - - >>> d2 - {'song': 'I dreamed a dream'} - >>> d2.update([("name","qiwsir"), ("web","itdiffer.com")]) - >>> d2 - {'web': 'itdiffer.com', 'name': 'qiwsir', 'song': 'I dreamed a dream'} - -列表的元组是键值对。 - -###has_key - -这个函数的功能是判断字典中是否存在某个键 - - has_key(...) - D.has_key(k) -> True if D has a key k, else False - -跟前一节中遇到的`k in D`类似。 - - >>> d2 - {'web': 'itdiffer.com', 'name': 'qiwsir', 'song': 'I dreamed a dream'} - >>> d2.has_key("web") - True - >>> "web" in d2 - True - -关于dict的函数,似乎不少。但是,不用着急,也不用担心记不住,因为根本不需要记忆。只要会用搜索即可。 - ------- - -[总目录](./index.md)   |   [上节:字典(1)](./116.md)   |   [下节:集合(1)](./118.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/118.md b/118.md deleted file mode 100644 index 688f64b..0000000 --- a/118.md +++ /dev/null @@ -1,275 +0,0 @@ ->Stay awake and pray that you may not come into the time of trial; the spirit indeed is willing, but the flesh is weak.(MATTHEW 26:41) - -#集合(1) - -回顾一下已经学过的数据类型:int/str/bool/list/dict/tuple - -还真的不少了. - -不过,python是一个发展的语言,没准以后还出别的呢.看官可能有疑问了,出了这么多的数据类型,我也记不住呀,特别是里面还有不少方法. - -不要担心记不住,你只要记住爱因斯坦说的就好了. - ->爱因斯坦在美国演讲,有人问:“你可记得声音的速度是多少?你如何记下许多东西?” - ->爱因斯坦轻松答道:“声音的速度是多少,我必须查辞典才能回答。因为我从来不记在辞典上已经印着的东西,我的记忆力是用来记忆书本上没有的东西。” - -多么霸气的回答,这回答不仅仅霸气,更告诉我们一种方法:只要能够通过某种方法查找到的,就不需要记忆. - -那么,上面那么多数据类型及其各种方法,都不需要记忆了,因为它们都可以通过下述方法但不限于这些方法查到(这句话的逻辑还是比较严密的,包括但不限于...) - -- 交互模式下用dir()或者help() -- google(不推荐Xdu,原因自己体会啦) - -在已经学过的数据类型中: - -- 能够索引的,如list/str,其中的元素可以重复 -- 可变的,如list/dict,即其中的元素/键值对可以原地修改 -- 不可变的,如str/int,即不能进行原地修改 -- 无索引序列的,如dict,即其中的元素(键值对)没有排列顺序 - -现在要介绍另外一种类型的数据,英文是set,翻译过来叫做“集合”。它的特点是:有的可变,有的不可变;元素无次序,不可重复。 - -##创建set - -tuple算是list和str的杂合(杂交的都有自己的优势,上一节的末后已经显示了),那么set则可以堪称是list和dict的杂合. - -set拥有类似dict的特点:可以用{}花括号来定义;其中的元素没有序列,也就是是非序列类型的数据;而且,set中的元素不可重复,这就类似dict的键. - -set也有一点list的特点:有一种集合可以原处修改. - -下面通过实验,进一步理解创建set的方法: - - >>> s1 = set("qiwsir") - >>> s1 - set(['q', 'i', 's', 'r', 'w']) - -把str中的字符拆解开,形成set.特别注意观察:qiwsir中有两个i,但是在s1中,只有一个i,也就是集合中元素不能重复。 - - >>> s2 = set([123,"google","face","book","facebook","book"]) - >>> s2 - set(['facebook', 123, 'google', 'book', 'face']) - -在创建集合的时候,如果发现了重复的元素,就会过滤一下,剩下不重复的。而且,从s2的创建可以看出,查看结果是显示的元素顺序排列与开始建立是不同,完全是随意显示的,这说明集合中的元素没有序列。 - - >>> s3 = {"facebook",123} #通过{}直接创建 - >>> s3 - set([123, 'facebook']) - -除了用`set()`来创建集合。还可以使用`{}`的方式,但是这种方式不提倡使用,因为在某些情况下,python搞不清楚是字典还是集合。看看下面的探讨就发现问题了。 - - >>> s3 = {"facebook",[1,2,'a'],{"name":"python","lang":"english"},123} - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - TypeError: unhashable type: 'dict' - - >>> s3 = {"facebook",[1,2],123} - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - TypeError: unhashable type: 'list' - -从上述实验中,可以看出,通过{}无法创建含有list/dict元素的set. - -认真阅读报错信息,有这样的词汇:“unhashable”,在理解这个词之前,先看它的反义词“hashable”,很多时候翻译为“可哈希”,其实它有一个不是音译的名词“散列”,这个在[《字典(1)》](./116.md)中有说明。网上搜一下,有不少文章对这个进行诠释。如果我们简单点理解,某数据“不可哈希”(unhashable)就是其可变,如list/dict,都能原地修改,就是unhashable。否则,不可变的,类似str那样不能原地修改,就是hashable(可哈希)的。 - -对于前面已经提到的字典,其键必须是hashable数据,即不可变的。 - -现在遇到的集合,其元素也要是“可哈希”的。上面例子中,试图将字典、列表作为元素的元素,就报错了。而且报错信息中明确告知list/dict是不可哈希类型,言外之意,里面的元素都应该是可哈希类型。 - -继续探索一个情况: - - >>> s1 - set(['q', 'i', 's', 'r', 'w']) - >>> s1[1] = "I" - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - TypeError: 'set' object does not support item assignment - -这里报错,进一步说明集合没有序列,不能用索引方式对其进行修改。 - - >>> s1 - set(['q', 'i', 's', 'r', 'w']) - >>> lst = list(s1) - >>> lst - ['q', 'i', 's', 'r', 'w'] - >>> lst[1] = "I" - >>> lst - ['q', 'I', 's', 'r', 'w'] - -分别用`list()`和`set()`能够实现两种数据类型之间的转化。 - -特别说明,利用`set()`建立起来的集合是可变集合,可变集合都是unhashable类型的。 - -##set的方法 - -还是用前面已经介绍过多次的自学方法,把set的有关内置函数找出来,看看都可以对set做什么操作. - - >>> dir(set) - ['__and__', '__class__', '__cmp__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__iand__', '__init__', '__ior__', '__isub__', '__iter__', '__ixor__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__ror__', '__rsub__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__xor__', 'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', 'union', 'update'] - -为了看的清楚,我把双划线__开始的先删除掉(后面我们会有专题讲述这些): - ->'add', 'clear', 'copy', 'difference', 'difference_update', 'discard', 'intersection', 'intersection_update', 'isdisjoint', 'issubset', 'issuperset', 'pop', 'remove', 'symmetric_difference', 'symmetric_difference_update', 'union', 'update' - -然后用help()可以找到每个函数的具体使用方法,下面列几个例子: - -###add, update - - >>> help(set.add) - - Help on method_descriptor: - - add(...) - Add an element to a set. - This has no effect if the element is already present. - -下面在交互模式这个最好的实验室里面做实验: - - >>> a_set = {} #我想当然地认为这样也可以建立一个set - >>> a_set.add("qiwsir") #报错.看看错误信息,居然告诉我dict没有add.我分明建立的是set呀. - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - AttributeError: 'dict' object has no attribute 'add' - >>> type(a_set) #type之后发现,计算机认为我建立的是一个dict - <type 'dict'> - -特别说明一下,{}这个东西,在dict和set中都用.但是,如上面的方法建立的是dict,不是set.这是python规定的.要建立set,只能用前面介绍的方法了. - - >>> a_set = {'a','i'} #这回就是set了吧 - >>> type(a_set) - <type 'set'> #果然 - - >>> a_set.add("qiwsir") #增加一个元素 - >>> a_set #原处修改,即原来的a_set引用对象已经改变 - set(['i', 'a', 'qiwsir']) - - >>> b_set = set("python") - >>> type(b_set) - <type 'set'> - >>> b_set - set(['h', 'o', 'n', 'p', 't', 'y']) - >>> b_set.add("qiwsir") - >>> b_set - set(['h', 'o', 'n', 'p', 't', 'qiwsir', 'y']) - - >>> b_set.add([1,2,3]) #报错.list是不可哈希的,集合中的元素应该是hashable类型。 - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - TypeError: unhashable type: 'list' - - >>> b_set.add('[1,2,3]') #可以这样! - >>> b_set - set(['[1,2,3]', 'h', 'o', 'n', 'p', 't', 'qiwsir', 'y']) - -除了上面的增加元素方法之外,还能够从另外一个set中合并过来元素,方法是set.update(s2) - - >>> help(set.update) - update(...) - Update a set with the union of itself and others. - - >>> s1 - set(['a', 'b']) - >>> s2 - set(['github', 'qiwsir']) - >>> s1.update(s2) #把s2的元素并入到s1中. - >>> s1 #s1的引用对象修改 - set(['a', 'qiwsir', 'b', 'github']) - >>> s2 #s2的未变 - set(['github', 'qiwsir']) - -###pop, remove, discard, clear - - >>> help(set.pop) - pop(...) - Remove and return an arbitrary set element. - Raises KeyError if the set is empty. - - >>> b_set - set(['[1,2,3]', 'h', 'o', 'n', 'p', 't', 'qiwsir', 'y']) - >>> b_set.pop() #从set中任意选一个删除,并返回该值 - '[1,2,3]' - >>> b_set.pop() - 'h' - >>> b_set.pop() - 'o' - >>> b_set - set(['n', 'p', 't', 'qiwsir', 'y']) - - >>> b_set.pop("n") #如果要指定删除某个元素,报错了. - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - TypeError: pop() takes no arguments (1 given) - -set.pop()是从set中任意选一个元素,删除并将这个值返回.但是,不能指定删除某个元素.报错信息中就告诉我们了,pop()不能有参数.此外,如果set是空的了,也报错.这条是帮助信息告诉我们的,看官可以试试. - -要删除指定的元素,怎么办? - - >>> help(set.remove) - - remove(...) - Remove an element from a set; it must be a member. - - If the element is not a member, raise a KeyError. - -`set.remove(obj)`中的obj,必须是set中的元素,否则就报错.试一试: - - >>> a_set - set(['i', 'a', 'qiwsir']) - >>> a_set.remove("i") - >>> a_set - set(['a', 'qiwsir']) - >>> a_set.remove("w") - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - KeyError: 'w' - -跟remove(obj)类似的还有一个discard(obj): - - >>> help(set.discard) - - discard(...) - Remove an element from a set if it is a member. - - If the element is not a member, do nothing. - -与`help(set.remove)`的信息对比,看看有什么不同.discard(obj)中的obj如果是set中的元素,就删除,如果不是,就什么也不做,do nothing.新闻就要对比着看才有意思呢.这里也一样. - - >>> a_set.discard('a') - >>> a_set - set(['qiwsir']) - >>> a_set.discard('b') - >>> - -在删除上还有一个绝杀,就是set.clear(),它的功能是:Remove all elements from this set.(看官自己在交互模式下help(set.clear)) - - >>> a_set - set(['qiwsir']) - >>> a_set.clear() - >>> a_set - set([]) - >>> bool(a_set) #空了,bool一下返回False. - False - -##知识 - -集合,也是一个数学概念(以下定义来自[维基百科](http://zh.wikipedia.org/wiki/%E9%9B%86%E5%90%88_%28%E6%95%B0%E5%AD%A6%29)) - ->集合(或简称集)是基本的数学概念,它是集合论的研究对象。最简单的说法,即是在最原始的集合论─朴素集合论─中的定义,集合就是“一堆东西”。集合里的“东西”,叫作元素。若然 x 是集合 A 的元素,记作 x ∈ A。 - ->集合是现代数学中一个重要的基本概念。集合论的基本理论直到十九世纪末才被创立,现在已经是数学教育中一个普遍存在的部分,在小学时就开始学习了。这里对被数学家们称为“直观的”或“朴素的”集合论进行一个简短而基本的介绍;更详细的分析可见朴素集合论。对集合进行严格的公理推导可见公理化集合论。 - -在计算机中,集合是什么呢?同样来自[维基百科](http://zh.wikipedia.org/wiki/%E9%9B%86%E5%90%88_%28%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%A7%91%E5%AD%A6%29),这么说的: - ->在计算机科学中,集合是一组可变数量的数据项(也可能是0个)的组合,这些数据项可能共享某些特征,需要以某种操作方式一起进行操作。一般来讲,这些数据项的类型是相同的,或基类相同(若使用的语言支持继承)。列表(或数组)通常不被认为是集合,因为其大小固定,但事实上它常常在实现中作为某些形式的集合使用。 - ->集合的种类包括列表,集,多重集,树和图。枚举类型可以是列表或集。 - -不管是否明白,貌似很厉害呀. - -是的,所以本讲仅仅是对集合有一个入门.关于集合的更多操作如运算/比较等,还没有涉及呢. - ------- - -[总目录](./index.md)   |   [上节:字典(2)](./117.md)   |   [下节:集合(2)](./119.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/119.md b/119.md deleted file mode 100644 index 0f22323..0000000 --- a/119.md +++ /dev/null @@ -1,143 +0,0 @@ ->Then Jesus came up and said to them, "All authority in heaven and on earth has been given to me. Therefore go and make disciples of all nations, baptizing them in the name of the Father and the Son and the Holy Spirit, teaching them to obey everything I have commanded you. And remember, I am with you always, to the end of the age." (MATTHEW 28:18-20) - -#集合(2) - -##不变的集合 - -[《集合(1)》](./118.md)中以`set()`来建立集合,这种方式所创立的集合都是可原处修改的集合,或者说是可变的,也可以说是unhashable - -还有一种集合,不能在原处修改。这种集合的创建方法是用`frozenset()`,顾名思义,这是一个被冻结的集合,当然是不能修改了,那么这种集合就是hashable类型——可哈希。 - - >>> f_set = frozenset("qiwsir") - >>> f_set - frozenset(['q', 'i', 's', 'r', 'w']) - >>> f_set.add("python") #报错,不能修改,则无此方法 - Traceback (most recent call last): - File "<stdin>", line 1, in <module> - AttributeError: 'frozenset' object has no attribute 'add' - - >>> a_set = set("github") #对比看一看,这是一个可以原处修改的set - >>> a_set - set(['b', 'g', 'i', 'h', 'u', 't']) - >>> a_set.add("python") - >>> a_set - set(['b', 'g', 'i', 'h', 'python', 'u', 't']) - -##集合运算 - -唤醒一下中学数学(准确说是高中数学中的一点知识)中关于集合的一点知识,当然,你如果是某个理工科的专业大学毕业,更应该熟悉集合之间的关系。 - -###元素与集合的关系 - -就一种关系,要么术语某个集合,要么不属于。 - - >>> aset - set(['h', 'o', 'n', 'p', 't', 'y']) - >>> "a" in aset - False - >>> "h" in aset - True - -###集合与集合的关系 - -假设两个集合A、B - -- A是否等于B,即两个集合的元素完全一样 - -在交互模式下实验 - - >>> a - set(['q', 'i', 's', 'r', 'w']) - >>> b - set(['a', 'q', 'i', 'l', 'o']) - >>> a == b - False - >>> a != b - True - -- A是否是B的子集,或者反过来,B是否是A的超集。即A的元素也都是B的元素,但是B的元素比A的元素数量多。 - -判断集合A是否是集合B的子集,可以使用`A<B`,返回true则是子集,否则不是。另外,还可以使用函数`A.issubset(B)`判断。 - - >>> a - set(['q', 'i', 's', 'r', 'w']) - >>> c - set(['q', 'i']) - >>> c<a #c是a的子集 - True - >>> c.issubset(a) #或者用这种方法,判断c是否是a的子集 - True - >>> a.issuperset(c) #判断a是否是c的超集 - True - - >>> b - set(['a', 'q', 'i', 'l', 'o']) - >>> a<b #a不是b的子集 - False - >>> a.issubset(b) #或者这样做 - False - -- A、B的并集,即A、B所有元素,如下图所示 - -![](./1images/11901.png) - -可以使用的符号是“|”,是一个半角状态写的竖线,输入方法是在英文状态下,按下"shift"加上右方括号右边的那个键。找找吧。表达式是`A | B`.也可使用函数`A.union(B)`,得到的结果就是两个集合并集,注意,这个结果是新生成的一个对象,不是将结合A扩充。 - - >>> a - set(['q', 'i', 's', 'r', 'w']) - >>> b - set(['a', 'q', 'i', 'l', 'o']) - >>> a | b #可以有两种方式,结果一样 - set(['a', 'i', 'l', 'o', 'q', 's', 'r', 'w']) - >>> a.union(b) - set(['a', 'i', 'l', 'o', 'q', 's', 'r', 'w']) - -- A、B的交集,即A、B所公有的元素,如下图所示 - -![](./1images/11902.png) - - >>> a - set(['q', 'i', 's', 'r', 'w']) - >>> b - set(['a', 'q', 'i', 'l', 'o']) - >>> a & b #两种方式,等价 - set(['q', 'i']) - >>> a.intersection(b) - set(['q', 'i']) - -我在实验的时候,顺手敲了下面的代码,出现的结果如下,看官能解释一下吗?(思考题) - - >>> a and b - set(['a', 'q', 'i', 'l', 'o']) - -- A相对B的差(补),即A相对B不同的部分元素,如下图所示 - -![](./1images/11903.png) - - >>> a - set(['q', 'i', 's', 'r', 'w']) - >>> b - set(['a', 'q', 'i', 'l', 'o']) - >>> a - b - set(['s', 'r', 'w']) - >>> a.difference(b) - set(['s', 'r', 'w']) - --A、B的对称差集,如下图所示 - -![](./1images/11904.png) - - >>> a - set(['q', 'i', 's', 'r', 'w']) - >>> b - set(['a', 'q', 'i', 'l', 'o']) - >>> a.symmetric_difference(b) - set(['a', 'l', 'o', 's', 'r', 'w']) - -以上是集合的基本运算。在编程中,如果用到,可以用前面说的方法查找。不用死记硬背。 - ------- - -[总目录](./index.md)   |   [上节:集合(1)](./118.md)   |   [下节:运算符](./120.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/120.md b/120.md deleted file mode 100644 index 54a3abe..0000000 --- a/120.md +++ /dev/null @@ -1,202 +0,0 @@ ->Jesus answered them, "Those who are well don't need a physician, but those who are sick do. I have not come to call the righteous, but sinners to repentance."(LUKE 5:31-32) - -#运算符 - -在编程语言,运算符是比较多样化的,虽然在[《常用数学函数和运算优先级》](./104.md)中给出了一个各种运算符和其优先级的表格,但是,那时对python理解还比较肤浅。建议诸位先回头看看那个表格,然后继续下面的内容。 - -这里将各种运算符总结一下,有复习,也有拓展。 - -##算术运算符 - -前面已经讲过了四则运算,其中涉及到一些运算符:加减乘除,对应的符号分别是:+ - * /,此外,还有求余数的:%。这些都是算术运算符。其实,算术运算符不止这些。根据中学数学的知识,看官也应该想到,还应该有乘方、开方之类的。 - -下面列出一个表格,将所有的运算符表现出来。不用记,但是要认真地看一看,知道有那些,如果以后用到,但是不自信能够记住,可以来查。 - -|运算符|描述 |实例 | -|------|--------------------|--------------------| -|+ |加 - 两个对象相加 | 10+20 输出结果 30 | -|- |减 - 得到负数或是一个数减去另一个数 | 10-20 输出结果 -10| -|* |乘 - 两个数相乘或是返回一个被重复若干次的字符串 | 10 * 20 输出结果 200| -|/ |除 - x除以y | 20/10 输出结果 2 | -|% |取余 - 返回除法的余数 | 20%10 输出结果 0 | -|** |幂 - 返回x的y次幂 | 10**2 输出结果 100 | -|// |取整除 - 返回商的整数部分 | 9//2 输出结果 4 , 9.0//2.0 输出结果 4.0 | - -列为看官可以根据中学数学的知识,想想上面的运算符在混合运算中,应该按照什么顺序计算。并且亲自试试,是否与中学数学中的规律一致。(应该是一致的,计算机科学家不会另外搞一套让我们和他们一块受罪。) - -##比较运算符 - -所谓比较,就是比一比两个东西。这在某国是最常见的了,做家长的经常把自己的孩子跟别人的孩子比较,唯恐自己孩子在某方面差了;官员经常把自己的收入和银行比较,总觉得少了。 - -在计算机高级语言编程中,任何两个同一类型的量的都可以比较,比如两个数字可以比较,两个字符串可以比较。注意,是两个同一类型的。不同类型的量可以比较吗?首先这种比较没有意义。就好比二两肉和三尺布进行比较,它们谁大呢?这种比较无意义。所以,在真正的编程中,我们要谨慎对待这种不同类型量的比较。 - -但是,在某些语言中,允许这种无意思的比较。因为它在比较的时候,都是将非数值的转化为了数值类型比较。 - -对于比较运算符,在小学数学中就学习了一些:大于、小于、等于、不等于。没有陌生的东西,python里面也是如此。且看下表: - -以下假设变量a为10,变量b为20: - -| 运算符 | 描述 | 实例 | -|--------|------|------| -|== | 等于 - 比较对象是否相等 | (a == b) 返回 False。| -|!= | 不等于 - 比较两个对象是否不相等 | (a != b) 返回 true. | -|> | 大于 - 返回x是否大于y | (a > b) 返回 False。| -|< | 小于 - 返回x是否小于y | (a < b) 返回 true。| -|>= | 大于等于 - 返回x是否大于等于y。| (a >= b) 返回 False。| -|<= | 小于等于 - 返回x是否小于等于y。| (a <= b) 返回 true。| - -上面的表格实例中,显示比较的结果就是返回一个true或者false,这是什么意思呢。就是在告诉你,这个比较如果成立,就是为真,返回True,否则返回False,说明比较不成立。 - -请按照下面方式进行比较操作,然后再根据自己的想象,把比较操作熟练熟练。 - - >>> a=10 - >>> b=20 - >>> a>b - False - >>> a<b - True - >>> a==b - False - >>> a!=b - True - >>> a>=b - False - >>> a<=b - True - -除了数字之外,还可以对字符串进行比较。字符串中的比较是按照“字典顺序”进行比较的。当然,这里说的是英文的字典,不是前面说的字典数据类型。 - - >>> a = "qiwsir" - >>> b = "python" - >>> a > b - True - -先看第一个字符,按照字典顺序,q大于p(在字典中,q排在p的后面),那么就返回结果True. - -在python中,如果是两种不同类型的对象,虽然可以比较。但我是不赞成这样进行比较的。 - - >>> a = 5 - >>> b = "5" - >>> a > b - False - -##逻辑运算符 - -首先谈谈什么是逻辑,韩寒先生对逻辑有一个分类: - ->逻辑分两种,一种是逻辑,另一种是中国人的逻辑。————韩寒 - -这种分类的确非常精准。在很多情况下,中国人是有很奇葩的逻辑的。但是,在python中,讲的是逻辑,不是中国人的逻辑。 - ->逻辑(logic),又称理则、论理、推理、推论,是有效推论的哲学研究。逻辑被使用在大部份的智能活动中,但主要在哲学、数学、语义学和计算机科学等领域内被视为一门学科。在数学里,逻辑是指研究某个形式语言的有效推论。 - -关于逻辑问题,看官如有兴趣,可以听一听[《国立台湾大学公开课:逻辑》](http://v.163.com/special/ntu/luoji.html) - -###布尔类型的变量 - -在所有的高级语言中,都有这么一类变量,被称之为布尔型。从这个名称,看官就知道了,这是用一个人的名字来命名的。 - ->乔治·布尔(George Boole,1815年11月-1864年,),英格兰数学家、哲学家。 - ->乔治·布尔是一个皮匠的儿子,生于英格兰的林肯。由于家境贫寒,布尔不得不在协助养家的同时为自己能受教育而奋斗,不管怎么说,他成了19世纪最重要的数学家之一。尽管他考虑过以牧师为业,但最终还是决定从教,而且不久就开办了自己的学校。 - ->在备课的时候,布尔不满意当时的数学课本,便决定阅读伟大数学家的论文。在阅读伟大的法国数学家拉格朗日的论文时,布尔有了变分法方面的新发现。变分法是数学分析的分支,它处理的是寻求优化某些参数的曲线和曲面。 - ->1848年,布尔出版了《The Mathematical Analysis of Logic》,这是他对符号逻辑诸多贡献中的第一次。 - ->1849年,他被任命位于爱尔兰科克的皇后学院(今科克大学或UCC)的数学教授。1854年,他出版了《The Laws of Thought》,这是他最著名的著作。在这本书中布尔介绍了现在以他的名字命名的布尔代数。布尔撰写了微分方程和差分方程的课本,这些课本在英国一直使用到19世纪末。 - ->由于其在符号逻辑运算中的特殊贡献,很多计算机语言中将逻辑运算称为布尔运算,将其结果称为布尔值。 - -请看官认真阅读布尔的生平,立志呀。 - -布尔所创立的这套逻辑被称之为“布尔代数”。其中规定只有两种值,True和False,正好对应这计算机上二进制数的1和0。所以,布尔代数和计算机是天然吻合的。 - -所谓布尔类型,就是返回结果为1(True)、0(False)的数据变量。 - -在python中(其它高级语言也类似,其实就是布尔代数的运算法则),有三种运算符,可以实现布尔类型的变量间的运算。 - -###布尔运算 - -看下面的表格,对这种逻辑运算符比较容易理解: - -(假设变量a为10,变量b为20) - -|运算符 | 描述 | 实例 | -|-------|-------|-------| -|and | 布尔"与" - 如果x为False,x and y返回False,否则它返回y的计算值。| (a and b) 返回 true。| -|or | 布尔"或" - 如果x是True,它返回True,否则它返回y的计算值。| (a or b) 返回 true。| -|not | 布尔"非" - 如果x为True,返回False。如果x为False,它返回True。 | not(a and b) 返回 false。| - -- and - -and,翻译为“与”运算,但事实上,这种翻译容易引起望文生义的理解。先说一下正确的理解。A and B,含义是:首先运算A,如果A的值是true,就计算B,并将B的结果返回做为最终结果,如果B是False,那么A and B的最终结果就是False,如果B的结果是True,那么A and B的结果就是True;如果A的值是False ,就不计算B了,直接返回A and B的结果为False. - -比如: - -`4>3 and 4<9`,首先看`4>3`的值,这个值是`True`,再看`4<9`的值,是`True`,那么最终这个表达式的结果为`True`. - - >>> 4>3 and 4<9 - True - -`4>3 and 4<2`,先看`4>3`,返回`True`,再看`4<2`,返回的是`False`,那么最终结果是`False`. - - >>> 4>3 and 4<2 - False - -`4<3 and 4<9`,先看`4<3`,返回为`False`,就不看后面的了,直接返回这个结果做为最终结果(对这种现象,有一个形象的说法,叫做“短路”。这个说法形象吗?不熟悉物理的是不是感觉形象?)。 - - >>> 4<3 and 4<2 - False - -前面说容易引起望文生义的理解,就是有相当不少的人认为无论什么时候都看and两边的值,都是true返回true,有一个是false就返回false。根据这种理解得到的结果,与前述理解得到的结果一样,但是,运算量不一样哦。 - -- or - -or,翻译为“或”运算。在A or B中,它是这么运算的: - - if A==True: - return True - else: - if B==True: - return True - else if B==False: - return False - -上面这段算是伪代码啦。所谓伪代码,就是不是真正的代码,无法运行。但是,伪代码也有用途,就是能够以类似代码的方式表达一种计算过程。 - -看官是不是能够看懂上面的伪代码呢?下面再增加上每行的注释。这个伪代码跟自然的英语差不多呀。 - - if A==True: #如果A的值是True - return True #返回True,表达式最终结果是True - else: #否则,也就是A的值不是True - if B==True: #看B的值,然后就返回B的值做为最终结果。 - return True - else if B==False: - return False - -举例,根据上面的运算过程,分析一下下面的例子,是不是与运算结果一致? - - >>> 4<3 or 4<9 - True - >>> 4<3 or 4>9 - False - >>> 4>3 or 4>9 - True - -- not - -not,翻译成“非”,窃以为非常好,不论面对什么,就是要否定它。 - - >>> not(4>3) - False - >>> not(4<3) - True - -关于运算符问题,其实不止上面这些,还有呢,比如成员运算符in,在后面的学习中会逐渐遇到。 - ------- - -[总目录](./index.md)   |   [上节:集合(2)](./119.md)   |   [下节:语句(1)](./121.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/121.md b/121.md deleted file mode 100644 index e689de9..0000000 --- a/121.md +++ /dev/null @@ -1,237 +0,0 @@ ->你们不要论断人,就不被论断;你们不要定人的罪,就不被定罪;你们要饶恕人,就必蒙饶恕。你们要给人,就必有给你们的,并且用十足的升斗,连摇带按、上尖下流地倒在你们怀里;因为你们用甚么量器量给人,也必用甚么量器量给你们。(LUKE 6:37-38) - -#语句(1) - -数据类型已经学的差不多了,但是,到现在为止我们还不能真正的写程序,这就好比小学生学习写作一样,到目前为止仅仅学会了一些词语,还不知道如何造句子。从现在开始就学习如何造句子了。 - -在编程语言中,句子被称之为“语句”, - -##什么是语句 - -事实上,前面已经用过语句了,最典型的那句:`print "Hello, World"`就是语句。 - -为了能够严谨地阐述这个概念,抄一段[维基百科中的词条:命令式编程](http://zh.wikipedia.org/wiki/%E6%8C%87%E4%BB%A4%E5%BC%8F%E7%B7%A8%E7%A8%8B) - ->命令式编程(英语:Imperative programming),是一种描述电脑所需作出的行为的编程范型。几乎所有电脑的硬件工作都是指令式的;几乎所有电脑的硬件都是设计来运行机器码,使用指令式的风格来写的。较高级的指令式编程语言使用变量和更复杂的语句,但仍依从相同的范型。 - ->运算语句一般来说都表现了在存储器内的数据进行运算的行为,然后将结果存入存储器中以便日后使用。高级命令式编程语言更能处理复杂的表达式,可能会产生四则运算和函数计算的结合。 - -一般所有高级语言,都包含如下语句,Python也不例外: - -- 循环语句:容许一些语句反复运行数次。循环可依据一个默认的数目来决定运行这些语句的次数;或反复运行它们,直至某些条件改变。 -- 条件语句:容许仅当某些条件成立时才运行某个区块。否则,这个区块中的语句会略去,然后按区块后的语句继续运行。 -- 无条件分支语句容许运行顺序转移到程序的其他部分之中。包括跳跃(在很多语言中称为Goto)、副程序和Procedure等。 - -循环、条件分支和无条件分支都是控制流程。 - -当然,python中的语句还是有python特别之处的(别的语言中,也会有自己的特色)。下面就开始娓娓道来。 - -##print - -在python2.x中,print是一个语句,但是在python3.x中它是一个函数了。这点请注意。不过,这里所使用的还是python2.x。 - ->为什么不用python3.x?这个问题在开始就回答过。但是还有朋友问。重复回答:因为现在很多工程项目都是python2.x,python3.x相对python2.x有不完全兼容的地方。学python的目的就是要在真实的工程项目中使用,理所应当要学python2.x。此外,学会了python2.x,将来过渡到python3.x,只需要注意一些细节即可。 - -print发起的语句,在程序中主要是将某些东西打印出来,还记得在讲解字符串的时候,专门讲述了字符串的格式化输出吗?那就是用来print的。 - - >>> print "hello, world" - hello, world - >>> print "hello","world" - hello world - -请仔细观察,上面两个print语句的差别。第一个打印的是"hello, world",包括其中的逗号和空格,是一个完整的字符串。第二个打印的是两个字符串,一个是"hello",另外一个是"world",两个字符串之间用逗号分隔。 - -本来,在print语句中,字符串后面会接一个`\n`符号。即换行。但是,如果要在一个字符串后面跟着逗号,那么换行就取消了,意味着两个字符串"hello","world"打印在同一行。 - -或许现在体现的还不时很明显,如果换一个方法,就显示出来了。(下面用到了一个被称之为循环的语句,下一节会重点介绍。 - - >>> for i in [1,2,3,4,5]: - ... print i - ... - 1 - 2 - 3 - 4 - 5 - -这个循环的意思就是要从列表中依次取出每个元素,然后赋值给变量i,并用print语句打印打出来。在变量i后面没有任何符号,每打印一个,就换行,再打印另外一个。 - -下面的方式就跟上面的有点区别了。 - - >>> for i in [1,2,3,4,5]: - ... print i , - ... - 1 2 3 4 5 - -就是在print语句的最后加了一个逗号,打印出来的就在一行了。 - -print语句经常用在调试程序的过程,让我们能够知道程序在执行过程中产生的结果。 - -##import - -在[《常用数学函数和运算优先级》](./104.md)中,曾经用到过一个math模块,它能提供很多数学函数,但是这些函数不是python的内建函数,是math模块的,所以,要用import引用这个模块。 - -这种用import引入模块的方法,是python编程经常用到的。引用方法有如下几种: - - >>> import math - >>> math.pow(3,2) - 9.0 - -这是常用的一种方式,而且非常明确,`math.pow(3,2)`就明确显示了,pow()函数是math模块里的。可以说这是一种可读性非常好的引用方式,并且不同模块的同名函数不会产生冲突。 - - >>> from math import pow - >>> pow(3,2) - 9.0 - -这种方法就有点偷懒了,不过也不难理解,从字面意思就知道pow()函数来自于math模块。在后续使用的时候,只需要直接使用`pow()`即可,不需要在前面写上模块名称了。这种引用方法,比较适合于引入模块较少的时候。如果引入模块多了,可读性就下降了,会不知道那个函数来自那个模块。 - - >>> from math import pow as pingfang - >>> pingfang(3,2) - 9.0 -这是在前面那种方式基础上的发展,将从某个模块引入的函数重命名,比如讲pow充命名为pingfang,然后使用`pingfang()`就相当于在使用`pow()`了。 - -如果要引入多个函数,可以这样做: - - >>> from math import pow, e, pi - >>> pow(e,pi) - 23.140692632779263 - -引入了math模块里面的pow,e,pi,pow()是一个乘方函数,e,就是那个欧拉数;pi就是π. - ->e,作为數學常數,是自然對數函數的底數。有時稱它為歐拉數(Euler's number),以瑞士數學家歐拉命名;也有個較鮮見的名字納皮爾常數,以紀念蘇格蘭數學家約翰·納皮爾引進對數。它是一个无限不循环小数。e = 2.71828182845904523536(《维基百科》) - ->e的π次方,是一个数学常数。与e和π一样,它是一个超越数。这个常数在希尔伯特第七问题中曾提到过。(《维基百科》) - - >>> from math import * - >>> pow(3,2) - 9.0 - >>> sqrt(9) - 3.0 - -这种引入方式是最贪图省事的了,一下将math中的所有函数都引过来了。不过,这种方式的结果是让可读性更降低了。仅适用于模块中的函数比较少的时候,并且在程序中应用比较频繁。 - -在这里,我们用math模块为例,引入其中的函数。事实上,不仅函数可以引入,模块中还可以包括常数等,都可以引入。在编程中,模块中可以包括各样的对象,都可以引入。 - -##赋值语句 - -对于赋值语句,应该不陌生,在前面已经频繁使用了,如`a = 3`这样的,就是将一个整数赋给了变量。 - ->编程中的“=”和数学中的“=”是完全不同的。在编程语言中,“=”表示赋值过程。 - -除了那种最简单的赋值之外,还可以这么干: - - >>> x, y, z = 1, "python", ["hello", "world"] - >>> x - 1 - >>> y - 'python' - >>> z - ['hello', 'world'] - -这里就一一对应赋值了。如果把几个值赋给一个,可以吗? - - >>> a = "itdiffer.com", "python" - - >>> a - ('itdiffer.com', 'python') - -原来是将右边的两个值装入了一个元组,然后将元组赋给了变量a。这个python太聪明了。 - -在python的赋值语句中,还有一个更聪明的,它一出场,简直是让一些已经学习过某种其它语言的人亮瞎眼。 - -有两个变量,其中`a = 2`,`b = 9`。现在想让这两个变量的值对调,即最终是`a = 9`,`b = 2`. - -这是一个简单而经典的题目。在很多编程语言中,是这么处理的: - - temp = a; - a = b; - b = temp; - -这么做的那些编程语言,变量就如同一个盒子,值就如同放到盒子里面的东西。如果要实现对调,必须在找一个盒子,将a盒子里面的东西(数字2)拿到那个临时盒子(temp)中,这样a盒子就空了,然后将b盒子中的东西拿(数字9)拿到a盒子中(a = b),完成这步之后,b盒子是空的了,最后将临时盒子里面的那个数字2拿到b盒子中。这就实现了两个变量值得对调。 - -太啰嗦了。 - -python只要一行就完成了。 - - >>> a = 2 - >>> b = 9 - - >>> a, b = b, a - - >>> a - 9 - >>> b - 2 - -`a, b = b, a`就实现了数值对调,多么神奇。之所以神奇,就是因为我前面已经数次提到的python中变量和数据对象的关系。变量相当于贴在对象上的标签。这个操作只不过是将标签换个位置,就分别指向了不同的数据对象。 - -还有一种赋值方式,被称为“链式赋值” - - >>> m = n = "I use python" - >>> print m,n - I use python I use python - -用这种方式,实现了一次性对两个变量赋值,并且值相同。 - - >>> id(m) - 3072659528L - >>> id(n) - 3072659528L - -用`id()`来检查一下,发现两个变量所指向的是同一个对象。 - -另外,还有一种判断方法,来检查两个变量所指向的值是否是同一个(注意,同一个和相等是有差别的。在编程中,同一个就是`id()`的结果一样。 - - >>> m is n - True - -这是在检查m和n分别指向的对象是否是同一个,True说明是同一个。 - - >>> a = "I use python" - >>> b = a - >>> a is b - True - -这是跟上面链式赋值等效的。 - -但是: - - >>> b = "I use python" - >>> a is b - False - >>> id(a) - 3072659608L - >>> id(b) - 3072659568L - - >>> a == b - True - -看出其中的端倪了吗?这次a、b两个变量虽然相等,但不是指向同一个对象。 - -还有一种赋值形式,如果从数学的角度看,是不可思议的,如:`x = x + 1`,在数学中,这个等式是不成立的。因为数学中的“=”是等于的含义,但是在编程语言中,它成立,因为"="是赋值的含义,即将变量x增加1之后,再把得到的结果赋值变量x. - -这种变量自己变化之后将结果再赋值给自己的形式,称之为“增量赋值”。+、-、*、/、%都可以实现这种操作。 - -为了让这个操作写起来省点事(要写两遍同样一个变量),可以写成:`x += 1` - - >>> x = 9 - >>> x += 1 - >>> x - 10 - -除了数字,字符串进行增量赋值,在实际中也很有价值。 - - >>> m = "py" - >>> m += "th" - >>> m - 'pyth' - >>> m += "on" - >>> m - 'python' - ------- - -[总目录](./index.md)   |   [上节:运算符](./120.md)   |   [下节:语句(2)](./122.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/122.md b/122.md deleted file mode 100644 index b4d0d76..0000000 --- a/122.md +++ /dev/null @@ -1,151 +0,0 @@ ->众百姓听的时候,耶稣对门徒说,“你们要防备文士,他们好穿长衣游行,喜爱人在街市上问他们安,又喜爱会堂里的高位,筵席上的首座。他们侵吞寡妇的家产,假意作很长的祷告。这些人要受更重的刑罚。”(LUKE 20:45-47) - -#语句(2) - -所谓条件语句,故名思,就是依据某个条件,满足这个条件后执行下面的内容。 - -##if - -if,其含义就是:conj. (表条件)如果。if发起的就是一个条件,它是构成条件语句的关键词。 - - >>> a = 8 - >>> if a==8: - ... print a - ... - 8 - -在交互模式下,简单书写一下if发起的条件语句。特别说明,我上面这样写,只是简单演示一下。如果你要写大段的代码,千万不要在交互模式下写。 - -`if a==8:`,这句话里面如果条件`a==8`返回的是True,那么就执行下面的语句。特别注意,冒号是必须的。下面一行语句`print a`要有四个空格的缩进。这是python的特点,称之为语句块。 - -唯恐说的不严谨,我还是引用维基百科中的叙述: - ->Python開發者有意讓違反了縮排規則的程序不能通過編譯,以此來強迫程序員養成良好的編程習慣。並且Python語言利用縮排表示語句塊的開始和結束(Off-side規則),而非使用花括號或者某種關鍵字。增加縮排表示語句塊的開始,而減少縮排則表示語句塊的結束。縮排成為了語法的一部分。例如if語句. - ->根據PEP的規定,必須使用4個空格來表示每級縮排。使用Tab字符和其它數目的空格雖然都可以編譯通過,但不符合編碼規範。支持Tab字符和其它数目的空格僅僅是為兼容很舊的Python程式和某些有問題的編輯程式。 - -从上面的这段话中,提炼出几个关键点: - -- 必须要通过缩进方式来表示语句块的开始和结束 -- 缩进用四个空格(也是必须的,别的方式或许可以,但不提倡) - -##if/else/elif - -在进行条件判断的时候,只有if,往往是不够的。比如下图所示的流程 - -![](./1images/12201.png) - -这张图反应的是这样一个问题: - -输入一个数字,并输出输入的结果,如果这个数字大于10,那么同时输出大于10,如果小于10,同时输出提示小于10,如果等于10,就输出表扬的一句话。 - -从图中就已经显示出来了,仅仅用if来判断,是不足的,还需要其它分支。这就需要引入别的条件判断了。所以,有了if...elif...else语句。 - -基本样式结构: - - if 条件1: - 执行的内容1 - elif 条件2: - 执行的内容2 - elif 条件3: - 执行的内容3 - else: - 执行的内容4 - -elif用于多个条件时使用,可以没有。另外,也可以只有if,而没有else。 - -下面我们就不在交互模式中写代码了。打开文本编辑界面,你的编辑器也能提供这个功能,如果找不到,请回到[《写一个简单的程序》](./105.md)查看。 - -代码实例如下: - - #! /usr/bin/env python - #coding:utf-8 - - print "请输入任意一个整数数字:" - - number = int(raw_input()) #通过raw_input()输入的数字是字符串 - #用int()将该字符串转化为整数 - - if number == 10: - print "您输入的数字是:%d"%number - print "You are SMART." - elif number > 10: - print "您输入的数字是:%d"%number - print "This number is more than 10." - elif number < 10: - print "您输入的数字是:%d"%number - print "This number is less than 10." - else: - print "Are you a human?" - -特别提醒看官注意,前面我们已经用过raw_input()函数了,这个是获得用户在界面上输入的信息,而通过它得到的是字符串类型的数据。 - -上述程序,依据条件进行判断,不同条件下做不同的事情了。需要提醒的是在条件中:number == 10,为了阅读方便,在number和==之间有一个空格最好了,同理,后面也有一个。这里的10,是int类型,number也是int类型. - -把这段程序保存成一个扩展名是.py的文件,比如保存为`num.py`,进入到存储这个文件的目录,运行`python num.py`,就能看到程序执行结果了。下面是我执行的结果,供参考。 - - $ python num.py - 请输入任意一个整数数字: - 12 - 您输入的数字是:12 - This number is more than 10. - - $ python num.py - 请输入任意一个整数数字: - 10 - 您输入的数字是:10 - You are SMART. - - $ python num.py - 请输入任意一个整数数字: - 9 - 您输入的数字是:9 - This number is less than 10. - -不知道各位是否注意到,上面的那段代码,开始有一行: - - #! /usr/bin/env python - -这是什么意思呢? - -这句话以#开头,表示本来不在程序中运行。这句话的用途是告诉机器寻找到该设备上的python解释器,操作系统使用它找到的解释器来运行文件中的程序代码。有的程序里写的是/usr/bin python,表示python解释器在/usr/bin里面。但是,如果写成/usr/bin/env,则表示要通过系统搜索路径寻找python解释器。不同系统,可能解释器的位置不同,所以这种方式能够让代码更将拥有可移植性。对了,以上是对Unix系列操作系统而言。对与windows系统,这句话就当不存在。 - -在“条件”中,就是上节提到的各种条件运算表达式,如果是True,就执行该条件下的语句。 - -##三元操作符 - -三元操作,是条件语句中比较简练的一种赋值方式,它的模样是这样的: - - >>> name = "qiwsir" if "laoqi" else "github" - >>> name - 'qiwsir' - >>> name = 'qiwsir' if "" else "python" - >>> name - 'python' - >>> name = "qiwsir" if "github" else "" - >>> name - 'qiwsir' - -总结一下:A = Y if X else Z - -什么意思,结合前面的例子,可以看出: - -- 如果X为真,那么就执行A=Y -- 如果X为假,就执行A=Z - -如此例 - - >>> x = 2 - >>> y = 8 - >>> a = "python" if x>y else "qiwsir" - >>> a - 'qiwsir' - >>> b = "python" if x<y else "qiwsir" - >>> b - 'python' - ------- - -[总目录](./index.md)   |   [上节:语句(1)](./121.md)   |   [下节:语句(3)](./123.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/123.md b/123.md deleted file mode 100644 index f508d25..0000000 --- a/123.md +++ /dev/null @@ -1,316 +0,0 @@ ->"But be on your guard so that your hearts are not wighted down with dissipation and drunkenness and the worries of this life, and that day close down upon you suddenly like a trap. For it will overtake all who live on the face of the whole earht. But staty alert at all times, praying that you may have strength to eacape all these things that must happen, and to stand before the Son of Man." - ->你们要谨慎,恐怕因贪食醉酒并今生的思虑,累住你们的心,那日子就如同网罗忽然临到你们。因为那日子要这样临到全地上一切居住的人。你们要是是儆醒,常常祈求,是你们能逃避这一切要来的事,得以站立在人子面前。(LUKE 21:34-36) - -#语句(3) - -循环,也是现实生活中常见的现象,我们常说日复一日,就是典型的循环。又如:日月更迭,斗转星移,无不是循环;王朝更迭;子子孙孙,繁衍不息,从某个角度看也都是循环。 - -编程语言就是要解决现实问题的,因此也少不了要循环。 - -在python中,循环有一个语句:for语句。 - -其基本结构是: - - for 循环规则: - 操作语句 - -从这个基本结构看,有着同if条件语句类似的地方:都有冒号;语句块都要缩进。是的,这是不可或缺的。 - -##简单的for循环例子 - -前面介绍print语句的时候,出现了一个简单例子。重复一个类似的: - - >>> hello = "world" - >>> for i in hello: - ... print i - ... - w - o - r - l - d - -这个for循环是怎么工作的呢? - -1. hello这个变量引用的是"world"这个str类型的数据 -2. 变量 i 通过hello找到它所引用的对象"world",因为str类型的数据属于序列类型,能够进行索引,于是就按照索引顺序,从第一字符开始,依次获得该字符的引用。 -3. 当 i="w"的时候,执行print i,打印出了字母w,结束之后循环第二次,让 i="e",然后执行print i,打印出字母e,如此循环下去,一直到最后一个字符被打印出来,循环自动结束。注意,每次打印之后,要换行。如果不想换行,怎么办?参见[《语句(1)》](./121.md)中关于print语句。 - -因为可以也通过使用索引(偏移量),得到序列对象的某个元素。所以,还可以通过下面的循环方式实现同样效果: - - >>> for i in range(len(hello)): - ... print hello[i] - ... - w - o - r - l - d - -其工作方式是: - -1. len(hello)得到hello引用的字符串的长度,为5 -2. range(len(hello),就是range(5),也就是[0, 1, 2, 3, 4],对应这"world"每个字母索引,也可以称之为偏移量。这里应用了一个新的函数`range()`,关于它的用法,继续阅读,就能看到了。 -3. for i in range(len(hello)),就相当于for i in [0,1,2,3,4],让i依次等于list中的各个值。当i=0时,打印hello[0],也就是第一个字符。然后顺序循环下去,直到最后一个i=4为止。 - -以上的循环举例中,显示了对str的字符依次获取,也涉及了list,感觉不过瘾呀。那好,看下面对list的循环: - - >>> ls_line - ['Hello', 'I am qiwsir', 'Welcome you', ''] - >>> for word in ls_line: - ... print word - ... - Hello - I am qiwsir - Welcome you - - >>> for i in range(len(ls_line)): - ... print ls_line[i] - ... - Hello - I am qiwsir - Welcome you - -##range(start,stop[, step]) - -这个内建函数,非常有必要给予说明,因为它会经常被使用。一般形式是`range(start, stop[, step])` - -要研究清楚一些函数特别是内置函数的功能,建议看官首先要明白内置函数名称的含义。因为在python中,名称不是随便取的,是代表一定意义的。所谓:名不正言不顺。 - ->range - ->n. 范围;幅度;排;山脉 ->vi. (在...内)变动;平行,列为一行;延伸;漫游;射程达到 ->vt. 漫游;放牧;使并列;归类于;来回走动 - -在具体实验之前,还是按照管理,摘抄一段[官方文档的原话](https://docs.python.org/2/library/functions.html#range),让我们能够深刻理解之: - ->This is a versatile function to create lists containing arithmetic progressions. It is most often used in for loops. The arguments must be plain integers. If the step argument is omitted, it defaults to 1. If the start argument is omitted, it defaults to 0. The full form returns a list of plain integers [start, start + step, start + 2 * step, ...]. If step is positive, the last element is the largest start + i * step less than stop; if step is negative, the last element is the smallest start + i * step greater than stop. step must not be zero (or else ValueError is raised). - -从这段话,我们可以得出关于`range()`函数的以下几点: - -- 这个函数可以创建一个数字元素组成的列表。 -- 这个函数最常用于for循环(关于for循环,马上就要涉及到了) -- 函数的参数必须是整数,默认从0开始。返回值是类似[start, start + step, start + 2*step, ...]的列表。 -- step默认值是1。如果不写,就是按照此值。 -- 如果step是正数,返回list的最最后的值不包含stop值,即start+i*step这个值小于stop;如果step是负数,start+i*step的值大于stop。 -- step不能等于零,如果等于零,就报错。 - -在实验开始之前,再解释range(start,stop[,step])的含义: - -- start:开始数值,默认为0,也就是如果不写这项,就是认为start=0 -- stop:结束的数值,必须要写的。 -- step:变化的步长,默认是1,也就是不写,就是认为步长为1。坚决不能为0 - -实验开始,请以各项对照前面的讲述: - - >>> range(9) #stop=9,别的都没有写,含义就是range(0,9,1) - [0, 1, 2, 3, 4, 5, 6, 7, 8] #从0开始,步长为1,增加,直到小于9的那个数 - >>> range(0,9) - [0, 1, 2, 3, 4, 5, 6, 7, 8] - >>> range(0,9,1) - [0, 1, 2, 3, 4, 5, 6, 7, 8] - - >>> range(1,9) #start=1 - [1, 2, 3, 4, 5, 6, 7, 8] - - >>> range(0,9,2) #step=2,每个元素等于start+i*step, - [0, 2, 4, 6, 8] - -仅仅解释一下range(0,9,2) - -- 如果是从0开始,步长为1,可以写成range(9)的样子,但是,如果步长为2,写成range(9,2)的样子,计算机就有点糊涂了,它会认为start=9,stop=2。所以,在步长不为1的时候,切忌,要把start的值也写上。 -- start=0,step=2,stop=9.list中的第一个值是start=0,第二个值是start+1*step=2(注意,这里是1,不是2,不要忘记,前面已经讲过,不论是list还是str,对元素进行编号的时候,都是从0开始的),第n个值就是start+(n-1)*step。直到小于stop前的那个值。 - -熟悉了上面的计算过程,看看下面的输入谁是什么结果? - - >>> range(-9) - -我本来期望给我返回[0,-1,-2,-3,-4,-5,-6,-7,-8],我的期望能实现吗? - -分析一下,这里start=0,step=1,stop=-9. - -第一个值是0;第二个是start+1*step,将上面的数代入,应该是1,但是最后一个还是-9,显然出现问题了。但是,python在这里不报错,它返回的结果是: - - >>> range(-9) - [] - >>> range(0,-9) - [] - >>> range(0) - [] - -报错和返回结果,是两个含义,虽然返回的不是我们要的。应该如何修改呢? - - >>> range(0,-9,-1) - [0, -1, -2, -3, -4, -5, -6, -7, -8] - >>> range(0,-9,-2) - [0, -2, -4, -6, -8] - -有了这个内置函数,很多事情就简单了。比如: - - >>> range(0,100,2) - [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98] - -100以内的自然数中的偶数组成的list,就非常简单地搞定了。 - -思考一个问题,现在有一个列表,比如是["I","am","a","pythoner","I","am","learning","it","with","qiwsir"],要得到这个list的所有序号组成的list,但是不能一个一个用手指头来数。怎么办? - -请沉思两分钟之后,自己实验一下,然后看下面。 - - >>> pythoner - ['I', 'am', 'a', 'pythoner', 'I', 'am', 'learning', 'it', 'with', 'qiwsir'] - >>> py_index = range(len(pythoner)) #以len(pythoner)为stop的值 - >>> py_index - [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - -再用手指头指着pythoner里面的元素,数一数,是不是跟结果一样。 - -**例:**找出100以内的能够被3整除的正整数。 - -**分析:**这个问题有两个限制条件,第一是100以内的正整数,根据前面所学,可以用range(1,100)来实现;第二个是要解决被3整除的问题,假设某个正整数n,这个数如果能够被3整除,也就是n%3(%是取余数)为0.那么如何得到n呢,就是要用for循环。 - -以上做了简单分析,要实现流程,还需要细化一下。按照前面曾经讲授过的一种方法,要画出问题解决的流程图。 - -![](./1images/12301.png) - -下面写代码就是按图索骥了。 - -代码: - - - #! /usr/bin/env python - #coding:utf-8 - - aliquot = [] - - for n in range(1,100): - if n%3 == 0: - aliquot.append(n) - - print aliquot - -代码运行结果: - - [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99] - -上面的代码中,将for循环和if条件判断都用上了。 - -不过,感觉有点麻烦,其实这么做就可以了: - - >>> range(3,100,3) - [3, 6, 9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99] - -##能够用来for的对象 - -所有的序列类型对象,都能够用for来循环。比如: - - >>> name_str = "qiwsir" - >>> for i in name_str: #可以对str使用for循环 - ... print i, - ... - q i w s i r - - >>> name_list = list(name_str) - >>> name_list - ['q', 'i', 'w', 's', 'i', 'r'] - >>> for i in name_list: #对list也能用 - ... print i, - ... - q i w s i r - - >>> name_set = set(name_str) #set还可以用 - >>> name_set - set(['q', 'i', 's', 'r', 'w']) - >>> for i in name_set: - ... print i, - ... - q i s r w - - >>> name_tuple = tuple(name_str) - >>> name_tuple - ('q', 'i', 'w', 's', 'i', 'r') - >>> for i in name_tuple: #tuple也能呀 - ... print i, - ... - q i w s i r - - >>> name_dict={"name":"qiwsir","lang":"python","website":"qiwsir.github.io"} - >>> for i in name_dict: #dict也不例外,这里本质上是将字典的键拿出来,成为序列后进行循环 - ... print i,"-->",name_dict[i] - ... - lang --> python - website --> qiwsir.github.io - name --> qiwsir - -在用for来循环读取字典键值对上,需要多说几句。 - -有这样一个字典: - - >>> a_dict = {"name":"qiwsir", "lang":"python", "email":"qiwsir@gmail.com", "website":"www.itdiffer.com"} - -曾记否?在[《字典(2)》](./117.md)中有获得字典键、值的函数:items/iteritems/keys/iterkeys/values/itervalues,通过这些函数得到的是键或者值的列表。 - - >>> for k in a_dict.keys(): - ... print k, a_dict[k] - ... - lang python - website www.itdiffer.com - name qiwsir - email qiwsir@gmail.com - -这是最常用的一种获得字典键/值对的方法,而且效率也不错。 - - >>> for k,v in a_dict.items(): - ... print k,v - ... - lang python - website www.itdiffer.com - name qiwsir - email qiwsir@gmail.com - - >>> for k,v in a_dict.iteritems(): - ... print k,v - ... - lang python - website www.itdiffer.com - name qiwsir - email qiwsir@gmail.com - -这两种方法也能够实现同样的效果,但是因为有了上面的方法,一般就少用了。但是,用也无妨,特别是第二个`iteritems()`,效率也是挺高的。 - -但是,要注意下面的方法: - - >>> for k in a_dict.keys(): - ... print k, a_dict[k] - ... - lang python - website www.itdiffer.com - name qiwsir - email qiwsir@gmail.com - -这种方法其实是不提倡的,虽然实现了同样的效果,但是效率常常是比较低的。切记。 - - >>> for v in a_dict.values(): - ... print v - ... - python - www.itdiffer.com - qiwsir - qiwsir@gmail.com - - >>> for v in a_dict.itervalues(): - ... print v - ... - python - www.itdiffer.com - qiwsir - qiwsir@gmail.com - -单独取values,推荐第二种方法。 - ------- - -[总目录](./index.md)   |   [上节:语句(2)](./122.md)   |   [下节:语句(4)](./124.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/124.md b/124.md deleted file mode 100644 index cf6efcd..0000000 --- a/124.md +++ /dev/null @@ -1,306 +0,0 @@ ->"I give you a new commandment, that you love one another. Just as I have loved you, you also should love one another. By this everyone will know that you are my disciples, if you have love for one another." (JOHN 14:34-35) - -#语句(4) - -for循环在python中应用广泛,所以,要用更多的篇幅来介绍。 - -##并行迭代 - -关于迭代,在[《列表(2)》](./112.md)中曾经提到过“可迭代的(iterable)”这个词,并给予了适当解释,这里再次提到“迭代”,说明它在python中占有重要的位置。 - -迭代,在python中表现就是用for循环,从序列对象中获得一定数量的元素。 - -在前面一节中,用for循环来获得列表、字符串、元组,乃至于字典的键值对,都是迭代。 - -现实中迭代不都是那么简单的,比如这个问题: - -**问题:**有两个列表,分别是:a = [1,2,3,4,5], b = [9,8,7,6,5],要计算这两个列表中对应元素的和。 - -**解析:** - -太简单了,一看就知道结果了。 - -很好,这是你的方法,如果是computer姑娘来做,应该怎么做呢? - -观察发现两个列表的长度一样,都是5。那么对应元素求和,就是相同的索引值对应的元素求和,即a[i]+b[i],(i=0,1,2,3,4),这样一个一个地就把相应元素和求出来了。当然,要用for来做这个事情了。 - - >>> a = [1,2,3,4,5] - >>> b = [9,8,7,6,5] - >>> c = [] - >>> for i in range(len(a)): - ... c.append(a[i]+b[i]) - ... - >>> c - [10, 10, 10, 10, 10] - -看来for的表现还不错。不过,这种方法虽然解决问题了,但python总不会局限于一个解决之道。于是又有一个内建函数`zip()`,可以让同样的问题有不一样的解决途径。 - -zip是什么东西?在交互模式下用help(zip),得到官方文档是: - ->zip(...) ->zip(seq1 [, seq2 [...]]) -> [(seq1[0], seq2[0] ...), (...)] - ->Return a list of tuples, where each tuple contains the i-th element from each of the argument sequences. The returned list is truncated in length to the length of the shortest argument sequence. - -seq1, seq2分别代表了序列类型的数据。通过实验来理解上面的文档: - - >>> a = "qiwsir" - >>> b = "github" - >>> zip(a,b) - [('q', 'g'), ('i', 'i'), ('w', 't'), ('s', 'h'), ('i', 'u'), ('r', 'b')] - -如果序列长度不同,那么就以"the length of the shortest argument sequence"为准。 - - >>> c = [1,2,3] - >>> d = [9,8,7,6] - >>> zip(c,d) - [(1, 9), (2, 8), (3, 7)] - - >>> m = {"name","lang"} - >>> n = {"qiwsir","python"} - >>> zip(m,n) - [('lang', 'python'), ('name', 'qiwsir')] - -m,n是字典吗?当然不是。下面的才是字典呢。 - - >>> s = {"name":"qiwsir"} - >>> t = {"lang":"python"} - >>> zip(s,t) - [('name', 'lang')] - -zip是一个内置函数,它的参数必须是某种序列数据类型,如果是字典,那么键视为序列。然后将序列对应的元素依次组成元组,做为一个list的元素。 - -下面是比较特殊的情况,参数是一个序列数据的时候,生成的结果样子: - - >>> a - 'qiwsir' - >>> c - [1, 2, 3] - >>> zip(c) - [(1,), (2,), (3,)] - >>> zip(a) - [('q',), ('i',), ('w',), ('s',), ('i',), ('r',)] - -很好的`zip()`!那么就用它来解决前面那个两个列表中值对应相加吧。 - - >>> d = [] - >>> for x,y in zip(a,b): - ... d.append(x+y) - ... - >>> d - [10, 10, 10, 10, 10] - -多么优雅的解决! - -比较这个问题的两种解法,似乎第一种解法适用面较窄,比如,如果已知给定的两个列表长度不同,第一种解法就出问题了。而第二种解法还可以继续适用。的确如此,不过,第一种解法也不是不能修订的。 - - >>> a = [1,2,3,4,5] - >>> b = ["python","www.itdiffer.com","qiwsir"] - -如果已知是这样两个列表,要讲对应的元素“加起来”。 - - >>> length = len(a) if len(a)<len(b) else len(b) - >>> length - 3 - -首先用这种方法获得两个列表中最短的那个列表的长度。看那句三元操作,这是非常pythonic的写法啦。写出这句,就可以冒充高手了。哈哈。 - - >>> for i in range(length): - ... c.append(str(a[i]) + ":" + b[i]) - ... - >>> c - ['1:python', '2:www.itdiffer.com', '3:qiwsir'] - -我还是用第一个思路做的,经过这么修正一下,也还能用。要注意一个细节,在“加”的时候,不能直接用`a[i]`,因为它引用的对象是一个int类型,不能跟后面的str类型相加,必须转化一下。 - -当然,`zip()`也是能解决这个问题的。 - - >>> d = [] - >>> for x,y in zip(a,b): - ... d.append(x + y) - ... - Traceback (most recent call last): - File "<stdin>", line 2, in <module> - TypeError: unsupported operand type(s) for +: 'int' and 'str' - -报错!看错误信息,我刚刚提醒的那个问题就冒出来了。所以,应该这么做: - - >>> for x,y in zip(a,b): - ... d.append(str(x) + ":" + y) - ... - >>> d - ['1:python', '2:www.itdiffer.com', '3:qiwsir'] - -这才得到了正确结果。 - -切记:**computer是一个姑娘,她非常秀气,需要敲代码的小伙子们耐心地、细心地跟她相处。** - -以上两种写法那个更好呢?前者?后者?哈哈。我看差不多了。 - - >>> result - [(2, 11), (4, 13), (6, 15), (8, 17)] - >>> zip(*result) - [(2, 4, 6, 8), (11, 13, 15, 17)] - -`zip()`还能这么干,是不是有点意思? - -下面延伸一个问题: - -**问题**:有一个dictionary,myinfor = {"name":"qiwsir","site":"qiwsir.github.io","lang":"python"},将这个字典变换成:infor = {"qiwsir":"name","qiwsir.github.io":"site","python":"lang"} - -**解析:** - -解法有几个,如果用for循环,可以这样做(当然,看官如果有方法,欢迎贴出来)。 - - >>> infor = {} - >>> for k,v in myinfor.items(): - ... infor[v]=k - ... - >>> infor - {'python': 'lang', 'qiwsir.github.io': 'site', 'qiwsir': 'name'} - -下面用zip()来试试: - - >>> dict(zip(myinfor.values(),myinfor.keys())) - {'python': 'lang', 'qiwsir.github.io': 'site', 'qiwsir': 'name'} - -呜呼,这是什么情况?原来这个zip()还能这样用。是的,本质上是这么回事情。如果将上面这一行分解开来,看官就明白其中的奥妙了。 - - >>> myinfor.values() #得到两个list - ['python', 'qiwsir', 'qiwsir.github.io'] - >>> myinfor.keys() - ['lang', 'name', 'site'] - >>> temp = zip(myinfor.values(),myinfor.keys()) #压缩成一个list,每个元素是一个tuple - >>> temp - [('python', 'lang'), ('qiwsir', 'name'), ('qiwsir.github.io', 'site')] - - >>> dict(temp) #这是函数dict()的功能,将上述列表转化为dictionary - {'python': 'lang', 'qiwsir.github.io': 'site', 'qiwsir': 'name'} - -至此,是不是明白zip()和循环的关系了呢?有了它可以让某些循环简化。 - -##enumerate - -这是一个有意思的内置函数,本来我们可以通过`for i in range(len(list))`的方式得到一个list的每个元素索引,然后在用list[i]的方式得到该元素。如果要同时得到元素索引和元素怎么办?就是这样了: - - >>> for i in range(len(week)): - ... print week[i]+' is '+str(i) #注意,i是int类型,如果和前面的用+连接,必须是str类型 - ... - monday is 0 - sunday is 1 - friday is 2 - -python中提供了一个内置函数enumerate,能够实现类似的功能 - - >>> for (i,day) in enumerate(week): - ... print day+' is '+str(i) - ... - monday is 0 - sunday is 1 - friday is 2 - -官方文档是这么说的: - ->Return an enumerate object. sequence must be a sequence, an iterator, or some other object which supports iteration. The next() method of the iterator returned by enumerate() returns a tuple containing a count (from start which defaults to 0) and the values obtained from iterating over sequence: - -顺便抄录几个例子,供看官欣赏,最好实验一下。 - - >>> seasons = ['Spring', 'Summer', 'Fall', 'Winter'] - >>> list(enumerate(seasons)) - [(0, 'Spring'), (1, 'Summer'), (2, 'Fall'), (3, 'Winter')] - >>> list(enumerate(seasons, start=1)) - [(1, 'Spring'), (2, 'Summer'), (3, 'Fall'), (4, 'Winter')] - -对于这样一个列表: - - >>> mylist = ["qiwsir",703,"python"] - >>> enumerate(mylist) - <enumerate object at 0xb74a63c4> - -出现这个结果,用list就能实现转换,显示内容.意味着可迭代。 - - >>> list(enumerate(mylist)) - [(0, 'qiwsir'), (1, 703), (2, 'python')] - -再设计一个小问题,练习一下这个函数。 - -**问题:**将字符串中的某些字符替换为其它的字符串。原始字符串"Do you love Canglaoshi? Canglaoshi is a good teacher.",请将"Canglaoshi"替换为"PHP". - -**解析:** - - >>> raw = "Do you love Canglaoshi? Canglaoshi is a good teacher." - -这是所要求的那个字符串,当时,不能直接对这个字符串使用`enumerate()`,因为它会变成这样: - - >>> list(enumerate(raw)) - [(0, 'D'), (1, 'o'), (2, ' '), (3, 'y'), (4, 'o'), (5, 'u'), (6, ' '), (7, 'l'), (8, 'o'), (9, 'v'), (10, 'e'), (11, ' '), (12, 'C'), (13, 'a'), (14, 'n'), (15, 'g'), (16, 'l'), (17, 'a'), (18, 'o'), (19, 's'), (20, 'h'), (21, 'i'), (22, '?'), (23, ' '), (24, 'C'), (25, 'a'), (26, 'n'), (27, 'g'), (28, 'l'), (29, 'a'), (30, 'o'), (31, 's'), (32, 'h'), (33, 'i'), (34, ' '), (35, 'i'), (36, 's'), (37, ' '), (38, 'a'), (39, ' '), (40, 'g'), (41, 'o'), (42, 'o'), (43, 'd'), (44, ' '), (45, 't'), (46, 'e'), (47, 'a'), (48, 'c'), (49, 'h'), (50, 'e'), (51, 'r'), (52, '.')] - -这不是所需要的。所以,先把raw转化为列表: - - >>> raw_lst = raw.split(" ") - -然后用`enumerate()` - - >>> for i, string in enumerate(raw_lst): - ... if string == "Canglaoshi": - ... raw_lst[i] = "PHP" - ... - -没有什么异常现象,查看一下那个raw_lst列表,看看是不是把"Canglaoshi"替换为"PHP"了。 - - >>> raw_lst - ['Do', 'you', 'love', 'Canglaoshi?', 'PHP', 'is', 'a', 'good', 'teacher.'] - -只替换了一个,还有一个没有替换。为什么?仔细观察发现,没有替换的那个是'Canglaoshi?',跟条件判断中的"Canglaoshi"不一样。 - -修改一下,把条件放宽: - - >>> for i, string in enumerate(raw_lst): - ... if "Canglaoshi" in string: - ... raw_lst[i] = "PHP" - ... - >>> raw_lst - ['Do', 'you', 'love', 'PHP', 'PHP', 'is', 'a', 'good', 'teacher.'] - -好的。然后呢?再转化为字符串?留给读者试试。 - -##list解析 - -先看下面的例子,这个例子是想得到1到9的每个整数的平方,并且将结果放在list中打印出来 - - >>> power2 = [] - >>> for i in range(1,10): - ... power2.append(i*i) - ... - >>> power2 - [1, 4, 9, 16, 25, 36, 49, 64, 81] - -python有一个非常有意思的功能,就是list解析,就是这样的: - - >>> squares = [x**2 for x in range(1,10)] - >>> squares - [1, 4, 9, 16, 25, 36, 49, 64, 81] - -看到这个结果,看官还不惊叹吗?这就是python,追求简洁优雅的python! - -其官方文档中有这样一段描述,道出了list解析的真谛: - ->List comprehensions provide a concise way to create lists. Common applications are to make new lists where each element is the result of some operations applied to each member of another sequence or iterable, or to create a subsequence of those elements that satisfy a certain condition. - -这就是python有意思的地方,也是计算机高级语言编程有意思的地方,你只要动脑筋,总能找到惊喜的东西。 - -其实,不仅仅对数字组成的list,所有的都可以如此操作。请在平复了激动的心之后,默默地看下面的代码,感悟一下list解析的魅力。 - - >>> mybag = [' glass',' apple','green leaf '] #有的前面有空格,有的后面有空格 - >>> [one.strip() for one in mybag] #去掉元素前后的空格 - ['glass', 'apple', 'green leaf'] - -上面的问题,都能用list解析来重写。读者不妨试试。 - -在很多情况下,list解析的执行效率高,代码简洁明了。是实际写程序中经常被用到的。 - ------- - -[总目录](./index.md)   |   [上节:语句(3)](./123.md)   |   [下节:语句(5)](./125.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/125.md b/125.md deleted file mode 100644 index 8d748ee..0000000 --- a/125.md +++ /dev/null @@ -1,213 +0,0 @@ ->他们虽然知道神,却不当做神荣耀他,也不感谢他。他们的思念变为虚妄,无知的心就昏暗了。自称为聪明,反成了愚拙;经不能朽坏值神的荣耀变为偶像,仿佛必朽坏的人和飞禽、走兽、昆虫的样式。(ROMANS 1:21-23) - -#用while来循环 - -while,翻译成中文是“当...的时候”,这个单词在英语中,常常用来做为时间状语,while ... someone do somthing,这种类型的说法是有的。在python中,它也有这个含义,不过有点区别的是,“当...时候”这个条件成立在一段范围或者时间间隔内,从而在这段时间间隔内让python做好多事情。就好比这样一段情景: - - while 年龄大于60岁:-------->当年龄大于60岁的时候 - 退休 -------->凡是符合上述条件就执行的动作 - -展开想象,如果制作一道门,这道门就是用上述的条件调控开关的,假设有很多人经过这个们,报上年龄,只要年龄大于60,就退休(门打开,人可以出去),一个接一个地这样循环下去,突然有一个人年龄是50,那么这个循环在他这里就停止,也就是这时候他不满足条件了。 - -这就是while循环。写一个严肃点的流程,可以看下图: - -![](./1images/20501.png) - -##做猜数字游戏 - -前不久,有一个在校的大学生朋友(他叫李航),给我发邮件,让我看了他做的游戏,能够实现多次猜数,直到猜中为止。这是一个多么喜欢学习的大学生呀。 - -我在这里将他写的程序恭录于此,如果李航同学认为此举侵犯了自己的知识产权,可以告知我,我马上撤下此代码。 - - #! /usr/bin/env python - #coding:UTF-8 - - import random - - i=0 - while i < 4: - print'********************************' - num = input('请您输入0到9任一个数:') #李同学用的是python3 - - xnum = random.randint(0,9) - - x = 3 - i - - if num == xnum: - print'运气真好,您猜对了!' - break - elif num > xnum: - print'''您猜大了!\n哈哈,正确答案是:%s\n您还有%s次机会!''' %(xnum,x) - elif num < xnum: - print'''您猜小了!\n哈哈,正确答案是:%s\n您还有%s次机会!''' %(xnum,x) - print'********************************' - - i += 1 - -我们就用这段程序来分析一下,首先看while i<4,这是程序中为猜测限制了次数,最大是三次,请看官注意,在while的循环体中的最后一句:i +=1,这就是说每次循环到最后,就给i增加1,当bool(i<4)为False的时候,就不再循环了。 - -当bool(i<4)为True的时候,就执行循环体内的语句。在循环体内,让用户输入一个整数,然后程序随机选择一个整数,最后判断随机生成的数和用户输入的数是否相等,并且用if语句判断三种不同情况。 - -根据上述代码,看官看看是否可以修改? - -为了让用户的体验更爽,不妨把输入的整数范围扩大,在1到100之间吧。 - - num_input = raw_input("please input one integer that is in 1 to 100:") #我用的是python2.7,在输入指令上区别于李同学 - -程序用num_input变量接收了输入的内容。但是,请列位看官一定要注意,看到这里想睡觉的要打起精神了,我要分享一个多年编程经验: - -请牢记:**任何用户输入的内容都是不可靠的。** - -这句话含义深刻,但是,这里不做过多的解释,需要各位在随后的编程生涯中体验了。为此,我们要检验用户输入的是否符合我们的要求,我们要求用户输入的是1到100之间的整数,那么就要做如下检验: - -1. 输入的是否是整数 -2. 如果是整数,是否在1到100之间。 - -为此,要做: - - if not num_input.isdigit(): #str.isdigit()是用来判断字符串是否纯粹由数字组成 - print "Please input interger." - elif int(num_input)<0 and int(num_input)>=100: - print "The number should be in 1 to 100." - else: - pass #这里用pass,意思是暂时省略,如果满足了前面提出的要求,就该执行此处语句 - -再看看李航同学的程序,在循环体内产生一个随机的数字,这样用户每次输入,面对的都是一个新的随机数字。这样的猜数字游戏难度太大了。我希望是程序产生一个数字,直到猜中,都是这个数字。所以,要把产生随机数字这个指令移动到循环之前。 - - import random - - number = random.randint(1,100) - - while True: #不限制用户的次数了 - ... - -观察李同学的程序,还有一点需要向列位显明的,那就是在条件表达式中,两边最好是同种类型数据,上面的程序中有:num>xnum样式的条件表达式,而一边是程序生成的int类型数据,一边是通过输入函数得到的str类型数据。在某些情况下可以运行,为什么?看官能理解吗?都是数字的时候,是可以的。但是,这样不好。 - -那么,按照这种思路,把这个猜数字程序重写一下: - - #!/usr/bin/env python - #coding:utf-8 - - import random - - number = random.randint(1,101) - - guess = 0 - - while True: - - num_input = raw_input("please input one integer that is in 1 to 100:") - guess += 1 - - if not num_input.isdigit(): - print "Please input interger." - elif int(num_input) < 0 or int(num_input) >= 100: - print "The number should be in 1 to 100." - else: - if number == int(num_input): - print "OK, you are good.It is only %d, then you successed." % guess - break - elif number > int(num_input): - print "your number is more less." - elif number < int(num_input): - print "your number is bigger." - else: - print "There is something bad, I will not work" - -以上供参考,看官还可改进。 - -##break和continue - -break,在上面的例子中已经出现了,其含义就是要在这个地方中断循环,跳出循环体。下面这个简要的例子更明显: - - #!/usr/bin/env python - #coding:utf-8 - - a = 8 - while a: - if a%2 == 0: - break - else: - print "%d is odd number"%a - a = 0 - print "%d is even number"%a - -a=8的时候,执行循环体中的break,跳出循环,执行最后的打印语句,得到结果: - - 8 is even number - -如果a=9,则要执行else里面的的print,然后a=0,循环就在执行一次,又break了,得到结果: - - 9 is odd number - 0 is even number - -而continue则是要从当前位置(即continue所在的位置)跳到循环体的最后一行的后面(不执行最后一行),对一个循环体来讲,就如同首尾衔接一样,最后一行的后面是哪里呢?当然是开始了。 - - #!/usr/bin/env python - #coding:utf-8 - - a = 9 - while a: - if a%2==0: - a -=1 - continue #如果是偶数,就返回循环的开始 - else: - print "%d is odd number"%a #如果是奇数,就打印出来 - a -=1 - -其实,对于这两东西,我个人在编程中很少用到。我有一个固执的观念,尽量将条件在循环之前做足,不要在循环中跳来跳去,不仅可读性下降,有时候自己也糊涂了。 - -##while...else - -这两个的配合有点类似if ... else,只需要一个例子列为就理解了,当然,一遇到else了,就意味着已经不在while循环内了。 - - #!/usr/bin/env python - - count = 0 - while count < 5: - print count, " is less than 5" - count = count + 1 - else: - print count, " is not less than 5" - -执行结果: - - 0 is less than 5 - 1 is less than 5 - 2 is less than 5 - 3 is less than 5 - 4 is less than 5 - 5 is not less than 5 - -##for...else - -除了有while...else外,还可以有for...else。这个循环也通常用在当跳出循环之后要做的事情。 - - #!/usr/bin/env python - # coding=utf-8 - - from math import sqrt - - for n in range(99, 1, -1): - root = sqrt(n) - if root == int(root): - print n - break - - else: - print "Nothing." - -读 -读者是否能够读懂这段代码的含义? - ->阅读代码是一个提升自己编程水平的好方法。如何阅读代码?像看网上新闻那样吗?一目只看自己喜欢的文字,甚至标题看不完就开始喷。 - ->绝对不是这样,如果这样,不是阅读代码呢。阅读代码的最好方法是给代码做注释。对,如果可能就给每行代码做注释。这样就能理解代码的含义了。 - -上面的代码,读者不妨做注释,看看它到底在干什么。如果把`for n in range(99, 1, -1)`修改为`for n in range(99, 81, -1)`看看是什么结果? - ------- - -[总目录](./index.md)   |   [上节:语句(4)](./124.md)   |   [下节:迭代](./126.md) - -如果你认为有必要打赏我,请通过支付宝:**qiwsir@126.com**,不胜感激。 \ No newline at end of file diff --git a/1code/110_2.py b/1code/110_2.py new file mode 100644 index 0000000..baa3797 --- /dev/null +++ b/1code/110_2.py @@ -0,0 +1,8 @@ +# -*- coding: cp936 -*- +#python 2 + +import sys + +print sys.getdefaultencoding() + +print "ѧpythonֵö" diff --git a/1code/110_3.py b/1code/110_3.py new file mode 100644 index 0000000..dc9d942 --- /dev/null +++ b/1code/110_3.py @@ -0,0 +1,7 @@ +#python 3 + +import sys + +print(sys.getdefaultencoding()) + +print("《跟老齐学python》值得读") diff --git a/1code/122p3.py b/1code/122p3.py new file mode 100644 index 0000000..9b1bdc2 --- /dev/null +++ b/1code/122p3.py @@ -0,0 +1,19 @@ +#! /usr/bin/env python +#coding:utf-8 + +print("请输入任意一个整数数字:") + +number = int(input()) + +if number == 10: + print("您输入的数字是:{}".format(number)) + print("You are SMART.") +elif number > 10: + print("您输入的数字是:{}".format(number)) + print("This number is more than 10.") +elif number < 10: + print("您输入的数字是:{}".format(number)) + print("This number is less than 10.") +else: + print("Are you a human?") + diff --git a/1code/12502p3.py b/1code/12502p3.py new file mode 100644 index 0000000..abfda92 --- /dev/null +++ b/1code/12502p3.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +#coding:utf-8 + +a = 8 +while a: + if a%2 == 0: + break + else: + print("%d is odd number"%a) + a = 0 + +print("%d is even number"%a) diff --git a/1code/12503p3.py b/1code/12503p3.py new file mode 100644 index 0000000..b50754c --- /dev/null +++ b/1code/12503p3.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python +#coding:utf-8 + +a = 9 +while a: + if a%2 == 0: + a -=1 + continue + else: + print("%d is odd number"%a) + a -=1 diff --git a/1code/127.txt b/1code/127.txt new file mode 100644 index 0000000..f8c83ae --- /dev/null +++ b/1code/127.txt @@ -0,0 +1,3 @@ +ʦhello +˫ܰ +ʦ \ No newline at end of file diff --git a/1code/12701.py b/1code/12701.py new file mode 100644 index 0000000..2480fc3 --- /dev/null +++ b/1code/12701.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +# coding=utf-8 + +f = open("you.md") + +while True: + line = f.readline() + if not line: + break + print line , + +f.close() diff --git a/1code/12901.py b/1code/12901.py new file mode 100644 index 0000000..a6a164f --- /dev/null +++ b/1code/12901.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python +# coding=utf-8 + +raw = [1,2,3,4,5,6,7,8,9,0] +print raw +b = raw.pop(0) +raw.append(b) + +print raw diff --git a/1code/12902.py b/1code/12902.py new file mode 100644 index 0000000..73f23ac --- /dev/null +++ b/1code/12902.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# coding=utf-8 + +from __future__ import division +import random + +score = [random.randint(0,100) for i in range(40)] +print score + +num = len(score) +sum_score = sum(score) +ave_num = sum_score/num +less_ave = len([i for i in score if i<ave_num]) +print "the average score is:%.1f" % ave_num +print "There are %d students less than average."%less_ave + +sorted_score = sorted(score, reverse=True) +print sorted_score diff --git a/1code/12903.py b/1code/12903.py new file mode 100644 index 0000000..00fe4f6 --- /dev/null +++ b/1code/12903.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# coding=utf-8 + +string = "I love code." +print string + +str_lst = string.split(" ") +print str_lst + +words = [s for s in str_lst if s!=""] +print words + +new_string = " ".join(words) +print new_string diff --git a/1code/12904.py b/1code/12904.py new file mode 100644 index 0000000..79562d1 --- /dev/null +++ b/1code/12904.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python +# coding=utf-8 + +a, b = 0, 1 + +for i in range(4): + a, b = b, a+b + +print a diff --git a/1code/12905.py b/1code/12905.py new file mode 100644 index 0000000..9a9bb77 --- /dev/null +++ b/1code/12905.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python +# coding=utf-8 + +n = int(raw_input("Enter an interger >=0: ")) + +fact = 1 + +for i in range(2, n + 1): + fact = fact * i + +print str(n) + " factorial is " + str(fact) diff --git a/1code/12905_2.py b/1code/12905_2.py new file mode 100644 index 0000000..a4e43f9 --- /dev/null +++ b/1code/12905_2.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +# coding=utf-8 + +n = int(raw_input('Enter an integer >= 0: ')) + +fact = 1 +i = 2 +while i<=n: + fact = fact * i + i += 1 + +print str(n) + " factorial is " + str(fact) diff --git a/1code/130.txt b/1code/130.txt new file mode 100644 index 0000000..38fb458 --- /dev/null +++ b/1code/130.txt @@ -0,0 +1,3 @@ +learn python +http://qiwsir.github.io +qiwsir@gmail.com diff --git a/1code/aliquot.py b/1code/aliquot.py new file mode 100644 index 0000000..541f677 --- /dev/null +++ b/1code/aliquot.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +# coding=utf-8 + +aliquot = [] + +for n in range(1, 100): + if n % 3 == 0: + aliquot.append(n) + +print(aliquot) diff --git a/1code/chartoint.py b/1code/chartoint.py new file mode 100644 index 0000000..9cd54c5 --- /dev/null +++ b/1code/chartoint.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# coding=utf-8 + +def change_char(character, n): + new = [] + for c in character: + i = ord(c) + n + new.append(chr(i)) + return "".join(new) + +if __name__ == "__main__": + one = "abc" + new = change_char(one, 2) + print one + print new + diff --git a/1code/guessnumber.py b/1code/guessnumber.py new file mode 100644 index 0000000..43ebeae --- /dev/null +++ b/1code/guessnumber.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# coding=utf-8 + +import random + +i=0 +while i < 4: + print('********************************') + num = input('请您输入0到9任一个数:') + + xnum = random.randint(0,9) + + x = 3 - i + + if num == xnum: + print('运气真好,您猜对了!') + break + elif num > xnum: + print('''您猜大了!\n哈哈,正确答案是:%s\n您还有%s次机会!''' %(xnum,x)) + elif num < xnum: + print('''您猜小了!\n哈哈,正确答案是:%s\n您还有%s次机会!''' %(xnum,x)) + print('********************************') + + i += 1 + diff --git a/1code/guessnumber2.py b/1code/guessnumber2.py new file mode 100644 index 0000000..52fea10 --- /dev/null +++ b/1code/guessnumber2.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# coding=utf-8 + +import random + +number = random.randint(1,100) + +guess = 0 + +while True: + + num_input = input("please input one integer that is in 1 to 100:") + guess += 1 + + if not num_input.isdigit(): + print("Please input interger.") + elif int(num_input) < 0 or int(num_input) >= 100: + print("The number should be in 1 to 100.") + else: + if number == int(num_input): + print("OK, you are good.It is only %d, then you successed." % guess) + break + elif number > int(num_input): + print("your number is smaller.") + elif number < int(num_input): + print("your number is bigger.") + else: + print("There is something bad, I will not work") + diff --git a/1code/helloworld.py b/1code/helloworld.py new file mode 100644 index 0000000..de111d0 --- /dev/null +++ b/1code/helloworld.py @@ -0,0 +1,3 @@ +# coding:utf-8 + +print("Hello, World") diff --git a/1code/judgenumber.py b/1code/judgenumber.py new file mode 100644 index 0000000..965c057 --- /dev/null +++ b/1code/judgenumber.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# coding=utf-8 + +print("请输入任意一个整数数字:") +number = int(input()) + +if number == 10: + print("您输入的数字是:{}".format(number)) + print("You are SMART.") +elif number > 10: + print("您输入的数字是:{}".format(number)) + print("This number is more than 10.") +else: + print("您输入的数字是:{}".format(number)) + print("This number is less than 10.") + diff --git a/1code/nameage.py b/1code/nameage.py new file mode 100644 index 0000000..cf9847a --- /dev/null +++ b/1code/nameage.py @@ -0,0 +1,14 @@ +# coding:utf-8 +''' +filename: nameage.py +''' + +name = input("What is your name?") +age = input("How old are you?") + +print("Your name is: ", name) +print("You are " + age + " years old.") + +after_ten = int(age) + 10 +print("You will be " + str(after_ten) + " years old after ten years.") + diff --git a/1code/simplemath.py b/1code/simplemath.py new file mode 100644 index 0000000..78d2133 --- /dev/null +++ b/1code/simplemath.py @@ -0,0 +1,9 @@ +#coding: utf-8 + +""" +请计算:19+2*4-8/2 +""" + +a = 19 + 2 * 4 - 8 / 2 +print(a) + diff --git a/1code/simplewhileloop.py b/1code/simplewhileloop.py new file mode 100644 index 0000000..70e7fe9 --- /dev/null +++ b/1code/simplewhileloop.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +# coding=utf-8 + +a = 1 +while a: + if a%2 == 0: + break + else: + print("{} is odd number".format(a)) + a -= 1 +print("{} is even number".format(a)) + diff --git a/1code/simplewhileloop2.py b/1code/simplewhileloop2.py new file mode 100644 index 0000000..a215b28 --- /dev/null +++ b/1code/simplewhileloop2.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +# coding=utf-8 + +a = 9 +while a: + if a%2 == 0: + a -=1 + continue #如果是偶数,就返回循环的开始 + else: + print("{} is odd number".format(a)) #如果是奇数,就打印出来 + a -=1 + diff --git a/1code/you.md b/1code/you.md new file mode 100644 index 0000000..d4716fe --- /dev/null +++ b/1code/you.md @@ -0,0 +1,9 @@ +You Raise Me Up +When I am down and, oh my soul, so weary; +When troubles come and my heart burdened be; +Then, I am still and wait here in the silence, +Until you come and sit awhile with me. +You raise me up, so I can stand on mountains; +You raise me up, to walk on stormy seas; +I am strong, when I am on your shoulders; +You raise me up: To more than I can be. diff --git a/1images/10508.jpg b/1images/10508.jpg new file mode 100644 index 0000000..af8fa52 Binary files /dev/null and b/1images/10508.jpg differ diff --git a/1images/12601.png b/1images/12601.png new file mode 100644 index 0000000..db3007c Binary files /dev/null and b/1images/12601.png differ diff --git a/1images/12602.png b/1images/12602.png new file mode 100644 index 0000000..f4f05d1 Binary files /dev/null and b/1images/12602.png differ diff --git a/1images/12603.png b/1images/12603.png new file mode 100644 index 0000000..e0d85eb Binary files /dev/null and b/1images/12603.png differ diff --git a/2code/20202.py b/2code/20202.py new file mode 100644 index 0000000..fd96262 --- /dev/null +++ b/2code/20202.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# coding=utf-8 + +def fibs(n): + """ + This is a Fibonacci sequence. + """ + result = [0,1] + for i in range(n-2): + result.append(result[-2] + result[-1]) + return result + +if __name__ == "__main__": + #lst = fibs(10) + #print lst + fibs(10) diff --git a/2code/20401.py b/2code/20401.py new file mode 100644 index 0000000..c807b45 --- /dev/null +++ b/2code/20401.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# coding=utf-8 + +def fib(n): + """ + This is Fibonacci by Recursion. + """ + if n==0: + return 0 + elif n==1: + return 1 + else: + return fib(n-1) + fib(n-2) + +if __name__ == "__main__": + f = fib(10) + print f diff --git a/2code/20402.py b/2code/20402.py new file mode 100644 index 0000000..d3a377f --- /dev/null +++ b/2code/20402.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# coding=utf-8 + +""" +the better Fibonacci +""" + +meno = {0:0, 1:1} + +def fib(n): + if not n in meno: + meno[n] = fib(n-1) + fib(n-2) + return meno[n] + +if __name__ == "__main__": + f = fib(10) + print f diff --git a/2code/20403.py b/2code/20403.py new file mode 100644 index 0000000..739faf9 --- /dev/null +++ b/2code/20403.py @@ -0,0 +1,10 @@ +#! /usr/bin/env python +# coding:utf-8 + +def convert(func, seq): + return [func(i) for i in seq] + +if __name__ == "__main__": + myseq = (111, 3.14, -9.21) + r = convert(str, myseq) + print r diff --git a/2code/20501.py b/2code/20501.py new file mode 100644 index 0000000..1ba535d --- /dev/null +++ b/2code/20501.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# coding=utf-8 + +""" +solving a quadratic equation +""" + +from __future__ import division +import math + +def quadratic_equation(a,b,c): + delta = b*b - 4*a*c + if delta<0: + return False + elif delta==0: + return -(b/(2*a)) + else: + sqrt_delta = math.sqrt(delta) + x1 = (-b + sqrt_delta)/(2*a) + x2 = (-b - sqrt_delta)/(2*a) + return x1, x2 + +if __name__ == "__main__": + print "a quadratic equation: x^2 + 3x + 2 = 0" + coefficients = (1, 3, 2) + roots = quadratic_equation(*coefficients) + if roots: + print "the result is:",roots + else: + print "this equation has no solution." diff --git a/2code/20501p3.py b/2code/20501p3.py new file mode 100644 index 0000000..95ca171 --- /dev/null +++ b/2code/20501p3.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# coding=utf-8 + +""" +solving a quadratic equation +""" + +import math + +def quadratic_equation(a,b,c): + delta = b*b - 4*a*c + if delta<0: + return False + elif delta==0: + return -(b/(2*a)) + else: + sqrt_delta = math.sqrt(delta) + x1 = (-b + sqrt_delta)/(2*a) + x2 = (-b - sqrt_delta)/(2*a) + return x1, x2 +if __name__ == "__main__": + print("a quadratic equation: x^2 + 2x + 1 = 0") + coefficients = (1, 2, 1) + roots = quadratic_equation(*coefficients) + if roots: + print("the result is:{}".format(roots)) + else: + print("this equation has no solution.") diff --git a/2code/20502.py b/2code/20502.py new file mode 100644 index 0000000..c978441 --- /dev/null +++ b/2code/20502.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +# coding=utf-8 +""" +count the examine scores +""" +from __future__ import division + +def average_score(scores): + """ + count average score. + """ + score_values = scores.values() + sum_scores = sum(score_values) + average = sum_scores/len(score_values) + return average + +def sorted_score(scores): + """ + count the list for max to min. + """ + score_lst = [(scores[k],k) for k in scores] + sort_lst = sorted(score_lst, reverse=True) + return [(i[1], i[0]) for i in sort_lst] + +def max_score(scores): + """ + the max scroe and the person's name. + """ + lst = sorted_score(scores) + max_score = lst[0][1] + return [(i[0],i[1]) for i in lst if i[1]==max_score] + +def min_score(scores): + """ + the min score and the person's name. + """ + lst = sorted_score(scores) + min_score = lst[len(lst)-1][1] + return [(i[0],i[1]) for i in lst if i[1]==min_score] + +if __name__ == "__main__": + examine_scores = {"google":98, "facebook":99, "baidu":52, "alibaba":80, "yahoo":49, "IBM":70, "android":76, "apple":99, "amazon":99} + + ave = average_score(examine_scores) + print "the average score is: ",ave + + sor = sorted_score(examine_scores) + print "list of the scores: ",sor + + xueba = max_score(examine_scores) + print "Xueba is: ",xueba + + xuezha = min_score(examine_scores) + print "Xuzha is: ",xuezha + diff --git a/2code/20502p3.py b/2code/20502p3.py new file mode 100644 index 0000000..b565dec --- /dev/null +++ b/2code/20502p3.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# coding=utf-8 +""" +统计考试成绩 +""" + +def average_score(scores): + """ + 统计平均分. + """ + score_values = scores.values() + sum_scores = sum(score_values) + average = round(sum_scores/len(score_values), 2) # round(a,2) 保留两位小数 + return average + +def sorted_score(scores): + """ + 对成绩从高到低排队. + """ + score_lst = [(scores[k],k) for k in scores] + sort_lst = sorted(score_lst, reverse=True) + return [(i[1], i[0]) for i in sort_lst] + +def max_score(scores): + """ + 成绩最高的姓名和分数. + """ + lst = sorted_score(scores) #引用分数排序的函数sorted_score + max_score = lst[0][1] + return [(i[0],i[1]) for i in lst if i[1]==max_score] + +def min_score(scores): + """ + 成绩最低的姓名和分数. + """ + lst = sorted_score(scores) + min_score = lst[len(lst)-1][1] + return [(i[0],i[1]) for i in lst if i[1]==min_score] + +if __name__ == "__main__": + examine_scores = {"google":98, "facebook":99, "baidu":52, "alibaba":80, "yahoo":49, "IBM":70, "android":76, "apple":99, "amazon":99} + + ave = average_score(examine_scores) + print("the average score is:{}".format(ave)) #平均分 + + sor = sorted_score(examine_scores) + print("list of the scores:{}".format(sor)) #成绩表 + + xueba = max_score(examine_scores) + print("Xueba is:{}".format(xueba)) #学霸们 + + xuezha = min_score(examine_scores) + print("Xuzha is:{}".format(xuezha)) #学渣们 diff --git a/2code/20503.py b/2code/20503.py new file mode 100644 index 0000000..41f5506 --- /dev/null +++ b/2code/20503.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# coding=utf-8 + +""" +find the prime +""" + +import math + +def is_prime(n): + """ + a integer is prime or not + """ + if n <= 1: + return False + for i in range(2, int(math.sqrt(n) + 1)): + if n % i == 0: + return False + return True + +if __name__ == "__main__": + primes = [i for i in range(2,100) if is_prime(i)] + print primes diff --git a/2code/20701.py b/2code/20701.py new file mode 100644 index 0000000..e32eb04 --- /dev/null +++ b/2code/20701.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# coding=utf-8 + +__metaclass__ = type + +class Person: + def __init__(self, name): + self.name = name + + def getName(self): + #return self.name + return girl.name + + def breast(self, n): + self.breast = n + + def color(self, color): + print "%s is %s" % (self.name, color) + + def how(self): + print "%s breast is %s" % (self.name, self.breast) + +girl = Person('canglaoshi') +name = girl.getName() +print name + +girl.breast(90) + +girl.color("white") +girl.how() diff --git a/2code/20701p3.py b/2code/20701p3.py new file mode 100644 index 0000000..7923143 --- /dev/null +++ b/2code/20701p3.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# coding=utf-8 + +class Person: + """ + This is a sample of class. + """ + + def __init__(self, name): + self.name = name + + def get_name(self): + return self.name + + def color(self, color): + d = {} + d[self.name] = color + return d + +if __name__ == "__main__": + girl = Person("canglaoshi") + print(girl.name) + name = girl.get_name() + print(name) + her_color = girl.color("white") + print(her_color) + diff --git a/2code/20702.py b/2code/20702.py new file mode 100644 index 0000000..ae445e0 --- /dev/null +++ b/2code/20702.py @@ -0,0 +1,16 @@ +#! /usr/bin/env python +# coding:utf-8 + +def convert(func, seq): + return [func(i) for i in seq] + +def num(n): + if n%2 == 0: + return n**n + else: + return n*n + +if __name__ == "__main__": + myseq = (3, 4, 5) + r = convert(num, myseq) + print r #Python 3: print(r) diff --git a/2code/20703.py b/2code/20703.py new file mode 100644 index 0000000..4903672 --- /dev/null +++ b/2code/20703.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python +#coding:utf-8 + +def foo(): + def bar(): + print "bar() is running" + bar() + print "foo() is running" + +#foo() +bar() diff --git a/2code/20703p3.py b/2code/20703p3.py new file mode 100644 index 0000000..fda0e6d --- /dev/null +++ b/2code/20703p3.py @@ -0,0 +1,10 @@ +def foo(): + a = 1 + def bar(): + nonlocal a + a = a + 1 + print("bar()a=",a) + bar() + print("foo()a=",a) + +foo() diff --git a/2code/20704.py b/2code/20704.py new file mode 100644 index 0000000..09f3af6 --- /dev/null +++ b/2code/20704.py @@ -0,0 +1,25 @@ + +def foo(fun): + def wrap(): + print "start" + fun() + print "end" + print fun.__name__ + return wrap + +@foo +def bar(): + print "I am in bar()" + + +bar() + + +#start +#I am in bar() +#end +#bar +#I am in bar() +#f = foo(bar) +#f() + diff --git a/2code/20801p3.py b/2code/20801p3.py new file mode 100644 index 0000000..638857e --- /dev/null +++ b/2code/20801p3.py @@ -0,0 +1,7 @@ + +class Foo: + def __init__(self): + print("I am in init()") + return None + +bar = Foo() diff --git a/2code/20901.py b/2code/20901.py new file mode 100644 index 0000000..aba5179 --- /dev/null +++ b/2code/20901.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# coding=utf-8 + +__metaclass__ = type + +class Person: + def speak(self): + print "I love you." + + def setHeight(self, n): + self.length = n + + def breast(self, n): + print "My breast is: ",n + +class Girl(Person): + def setHeight(self): + print "The height is:1.70m ." + +if __name__ == "__main__": + cang = Girl() + cang.setHeight() + cang.speak() + cang.breast(90) diff --git a/2code/20902.py b/2code/20902.py new file mode 100644 index 0000000..399927a --- /dev/null +++ b/2code/20902.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# coding=utf-8 + +__metaclass__ = type + +class Person: + + def eye(self): + print "two eyes" + + def breast(self, n): + print "The breast is: ",n + +class Girl: + age = 28 + def color(self): + print "The girl is white" + +class HotGirl(Person, Girl): + pass + +if __name__ == "__main__": + kong = HotGirl() + kong.eye() + kong.breast(90) + kong.color() + print kong.age diff --git a/2code/20902_1.py b/2code/20902_1.py new file mode 100644 index 0000000..088a73a --- /dev/null +++ b/2code/20902_1.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# coding=utf-8 + +__metaclass__ = type + +class Person: + + def eye(self): + print "two eyes" + + def breast(self, n): + print "The breast is: ",n + +class Girl: + age = 28 + def color(self): + print "The girl is white" + def eye(self): + print "girl's eyes are big." + +class HotGirl(Person, Girl): + pass + +if __name__ == "__main__": + kong = HotGirl() + kong.eye() + kong.breast(90) + kong.color() + print kong.age diff --git a/2code/20903.py b/2code/20903.py new file mode 100644 index 0000000..152d946 --- /dev/null +++ b/2code/20903.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# coding=utf-8 + +__metaclass__ = type + +class Person: + def __init__(self): + self.height = 160 + + def about(self, name): + print "{} is about {}".format(name, self.height) + +class Girl(Person): + def __init__(self): + super(Girl, self).__init__() + self.breast = 90 + + def about(self, name): + print "{} is a hot girl, she is about {}, and her breast is {}".format(name, self.height, self.breast) + super(Girl, self).about(name) + +if __name__ == "__main__": + cang = Girl() + cang.about("canglaoshi") diff --git a/2code/20904.py b/2code/20904.py new file mode 100644 index 0000000..4f132a1 --- /dev/null +++ b/2code/20904.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# coding=utf-8 + +class K1(object): + def foo(self): + print "K1-foo" + +class K2(object): + def foo(self): + print "K2-foo" + def bar(self): + print "K2-bar" + +class J1(K1, K2): + pass + +class J2(K1, K2): + def bar(self): + print "J2-bar" + +class C(J1, J2): + pass + +if __name__ == "__main__": + print C.__mro__ + m = C() + m.foo() + m.bar() + diff --git a/2code/20905.py b/2code/20905.py new file mode 100644 index 0000000..6bbfe82 --- /dev/null +++ b/2code/20905.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# coding=utf-8 + +class Person(object): + def __init__(self, name): + self.name = name + + def height(self, m): + h = dict((["height", m],)) + return h + + def breast(self, n): + b = dict((["breast", n],)) + return b + +class Girl(Person): + def __init__(self, name): + #Person.__init__(self, name) + super(Girl, self).__init__(name) + self.real_name = "Aoi sola" + + def get_name(self): + return self.name + +if __name__ == "__main__": + cang = Girl("canglaoshi") + print cang.real_name + print cang.get_name() + print cang.height(160) + print cang.breast(90) diff --git a/2code/20905p3.py b/2code/20905p3.py new file mode 100644 index 0000000..3dc2722 --- /dev/null +++ b/2code/20905p3.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# coding=utf-8 + +class Person: + def __init__(self, name): + self.name = name + + def height(self, m): + h = dict((["height", m],)) + return h + + def breast(self, n): + b = dict((["breast", n],)) + return b + +class Girl(Person): + def __init__(self,name): + super(Girl, self).__init__(name) + self.real_name = "Aoi sola" + + def get_name(self): + return self.name + +if __name__ == "__main__": + cang = Girl("canglaoshi") + print(cang.get_name()) + print(cang.height(160)) + print(cang.breast(90)) diff --git a/2code/21001.py b/2code/21001.py new file mode 100644 index 0000000..6296047 --- /dev/null +++ b/2code/21001.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# coding=utf-8 + +__metaclass__ = type + +class StaticMethod: + @staticmethod + def foo(): + print "This is static method foo()." + + +class ClassMethod: + @classmethod + def bar(cls): + print "This is class method bar()." + print "bar() is part of class:", cls.__name__ + +if __name__ == "__main__": + static_foo = StaticMethod() + static_foo.foo() + StaticMethod.foo() + print "********" + class_bar = ClassMethod() + class_bar.bar() + ClassMethod.bar() diff --git a/2code/21101.py b/2code/21101.py new file mode 100644 index 0000000..d2df455 --- /dev/null +++ b/2code/21101.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# coding=utf-8 + +"the code is from: http://zetcode.com/lang/python/oop/" + +__metaclass__ = type + +class Animal: + def __init__(self, name=""): + self.name = name + + def talk(self): + pass + +class Cat(Animal): + def talk(self): + print "Meow!" + +class Dog(Animal): + def talk(self): + print "Woof!" + + +a = Animal() +a.talk() + +c = Cat("Missy") +c.talk() + +d = Dog("Rocky") +d.talk() diff --git a/2code/21102.py b/2code/21102.py new file mode 100644 index 0000000..f922f37 --- /dev/null +++ b/2code/21102.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# coding=utf-8 + +__metaclass__ = type + +class ProtectMe: + def __init__(self): + self.me = "qiwsir" + self.__name = "kivi" + + def __python(self): + print "I love Python." + + def code(self): + print "Which language do you like?" + self.__python() + + @property + def name(self): + return self.__name + +if __name__ == "__main__": + p = ProtectMe() + #print p.me + print p.name + #p.code() + #p._ProtectMe.__python() + diff --git a/2code/21301.py b/2code/21301.py new file mode 100644 index 0000000..fe0fb15 --- /dev/null +++ b/2code/21301.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# coding=utf-8 + +""" +study __getattr__ and __setattr__ +""" + +class Rectangle(object): + """ + the width and length of Rectangle + """ + def __init__(self): + self.width = 0 + self.length = 0 + + def setSize(self, size): + self.width, self.length = size + def getSize(self): + return self.width, self.length + size = property(getSize, setSize) + +class NewRectangle(object): + def __init__(self): + self.width = 0 + self.length = 0 + + def __setattr__(self, name, value): + if name == "size": + self.width, self.length = value + else: + self.__dict__[name] = value + + def __getattr__(self, name): + if name == "size": + return self.width, self.length + else: + raise AttributeError + +if __name__ == "__main__": + r = NewRectangle() + r.width = 3 + r.length = 4 + print r.size + r.size = 30, 40 + print r.width + print r.length + diff --git a/2code/21302.py b/2code/21302.py new file mode 100644 index 0000000..34e338c --- /dev/null +++ b/2code/21302.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python +# coding=utf-8 + +class A(object): + author = "qiwsir" + def __getattr__(self, name): + if name != "author": + return "from starter to master." + +if __name__ == "__main__": + a = A() + print a.author + print a.lang diff --git a/2code/21401.py b/2code/21401.py new file mode 100644 index 0000000..9a1924d --- /dev/null +++ b/2code/21401.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# coding=utf-8 + +""" +the interator as range() +""" +class MyRange(object): + def __init__(self, n): + self.i = 1 + self.n = n + + def __iter__(self): + return self + + def next(self): + if self.i <= self.n: + i = self.i + self.i += 1 + return i + else: + raise StopIteration() + +if __name__ == "__main__": + x = MyRange(3) + print "self.n=",x.n,";","self.i=",x.i + x.next() + print "self.n=",x.n,";","self.i=",x.i + x.next() + print "self.n=",x.n,";","self.i=",x.i + x.next() + print "self.n=",x.n,";","self.i=",x.i + x.next() + print "self.n=",x.n,";","self.i=",x.i + + #print [i for i in x] + #print list(x) + #print "x.next()==>", x.next() + #print "x.next()==>", x.next() + #print "------for loop--------" + #for i in x: + # print i diff --git a/2code/21401p3.py b/2code/21401p3.py new file mode 100644 index 0000000..107b94e --- /dev/null +++ b/2code/21401p3.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# coding=utf-8 + +""" +the interator as range() +""" +class MyRange(object): + def __init__(self, n): + self.i = 1 + self.n = n + + def __iter__(self): + return self + + def __next__(self): + if self.i <= self.n: + i = self.i + self.i += 1 + return i + else: + raise StopIteration() + +if __name__ == "__main__": + x = MyRange(7) + print([i for i in x]) + #print list(x) + #print "x.next()==>", x.next() + #print "x.next()==>", x.next() + #print "------for loop--------" + #for i in x: + # print i diff --git a/2code/21402.py b/2code/21402.py new file mode 100644 index 0000000..368cd9a --- /dev/null +++ b/2code/21402.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# coding=utf-8 +""" +compute Fibonacci by iterator +""" +__metaclass__ = type + +class Fibs: + def __init__(self, max): + self.max = max + self.a = 0 + self.b = 1 + + def __iter__(self): + return self + + def next(self): + fib = self.a + if fib > self.max: + raise StopIteration + self.a, self.b = self.b, self.a + self.b + return fib + +if __name__ == "__main__": + fibs = Fibs(5) + print list(fibs) + + diff --git a/2code/21501.py b/2code/21501.py new file mode 100644 index 0000000..fc06099 --- /dev/null +++ b/2code/21501.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# coding=utf-8 + +def fibs(max): + n, a, b = 0, 0, 1 + while n < max: + yield b + a, b = b, a + b + n = n + 1 + +if __name__ == "__main__": + f = fibs(10) + for i in f: + print i , diff --git a/2code/21601.py b/2code/21601.py new file mode 100644 index 0000000..947780f --- /dev/null +++ b/2code/21601.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# coding=utf-8 + +""" +try... except +""" + +while 1: + print "this is a division program." + c = raw_input("input 'c' continue, otherwise logout:") + if c == 'c': + a = raw_input("first number:") + b = raw_input("second number:") + try: + print float(a)/float(b) + print "*************************" + except ZeroDivisionError: + print "The second number can't be zero!" + print "*************************" + else: + break + diff --git a/2code/21601p3.py b/2code/21601p3.py new file mode 100644 index 0000000..e3cef24 --- /dev/null +++ b/2code/21601p3.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# coding=utf-8 + +while 1: + print("this is a division program.") + c = input("input 'c' continue, otherwise logout:") + if c == 'c': + a = input("first number:") + b = input("second number:") + try: + print(float(a)/float(b)) + print("*************************") + except ZeroDivisionError: + print("The second number can't be zero!") + print("*************************") + else: + break diff --git a/2code/21602.py b/2code/21602.py new file mode 100644 index 0000000..151ca36 --- /dev/null +++ b/2code/21602.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# coding=utf-8 + +class Calculator(object): + is_raise = False + def calc(self, express): + try: + return eval(express) + except ZeroDivisionError: + if self.is_raise: + print "zero can not be division." + else: + raise + +if __name__ == "__main__": + c = Calculator() + c.is_raise = True + print c.calc("8/0") diff --git a/2code/21701.py b/2code/21701.py new file mode 100644 index 0000000..c0441af --- /dev/null +++ b/2code/21701.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# coding=utf-8 + +""" +try... except +""" + +while 1: + print("this is a division program.") + c = input("input 'c' continue, otherwise logout:") + if c == 'c': + a = input("first number:") + b = input("second number:") + try: + print(float(a)/float(b)) + print("*************************") + #except ZeroDivisionError: + # print("The second number can't be zero!") + # print("*************************") + #except ValueError: + # print("please input number.") + # print("************************") + except (ZeroDivisionError, ValueError) as e: + print(e) + #print("please input rightly.") + print("********************") + else: + break + diff --git a/2code/21702.py b/2code/21702.py new file mode 100644 index 0000000..5a703c4 --- /dev/null +++ b/2code/21702.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# coding=utf-8 + +""" +try... except +""" + +while 1: + print "this is a division program." + c = raw_input("input 'c' continue, otherwise logout:") + if c == 'c': + a = raw_input("first number:") + b = raw_input("second number:") + try: + print float(a)/float(b) + print "*************************" + #except ZeroDivisionError: + # print "The second number can't be zero!" + # print "*************************" + #except ValueError: + # print "please input number." + # print "************************" + except: + print "some wrong..." + print "********************" + else: + break + diff --git a/2code/21703.py b/2code/21703.py new file mode 100644 index 0000000..c7af5a9 --- /dev/null +++ b/2code/21703.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# coding=utf-8 +while 1: + try: + x = raw_input("the first number:") + y = raw_input("the second number:") + + r = float(x)/float(y) + print r + except Exception, b: + print b + print "try again." + else: + break diff --git a/2code/21703p3.py b/2code/21703p3.py new file mode 100644 index 0000000..1bd4040 --- /dev/null +++ b/2code/21703p3.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# coding=utf-8 +while 1: + try: + x = input("the first number:") + y = input("the second number:") + + r = float(x)/float(y) + print(r) + except Exception as e: + print(e) + print("try again.") + else: + break diff --git a/2code/21801.py b/2code/21801.py new file mode 100644 index 0000000..9d4884f --- /dev/null +++ b/2code/21801.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# coding=utf-8 + +class Account(object): + def __init__(self, number): + self.number = number + self.balance = 0 + + def deposit(self, amount): + assert amount > 0 + self.balance += balance + + def withdraw(self, amount): + assert amount > 0 + if amount <= self.balance: + self.balance -= amount + else: + print "balance is not enough." + +if __name__ == "__main__": + a = Account(1000) + a.deposit(-10) diff --git a/2code/22101.py b/2code/22101.py new file mode 100644 index 0000000..a656fce --- /dev/null +++ b/2code/22101.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python +# coding=utf-8 + +import sys + +print "The file name: ", sys.argv[0] +print "The number of argument", len(sys.argv) +print "The argument is: ", str(sys.argv) diff --git a/2code/22102.py b/2code/22102.py new file mode 100644 index 0000000..b05010e --- /dev/null +++ b/2code/22102.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python +# coding=utf-8 + +import sys + +sys.exit("hello") diff --git a/2code/22102p3.py b/2code/22102p3.py new file mode 100644 index 0000000..df4ecb0 --- /dev/null +++ b/2code/22102p3.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python +# coding=utf-8 + +import sys + +#sys.exit("hello") +for i in range(10): + if i == 5: + sys.exit() + else: + print(i) diff --git a/2code/22103.py b/2code/22103.py new file mode 100644 index 0000000..be9c3d6 --- /dev/null +++ b/2code/22103.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# coding=utf-8 + +import copy + +class MyCopy(object): + def __init__(self, value): + self.value = value + + def __repr__(self): + return str(self.value) + +foo = MyCopy(7) + +a = ["foo", foo] +b = a[:] +c = list(a) +d = copy.copy(a) +e = copy.deepcopy(a) + +a.append("abc") +foo.value = 17 + +print("original: {0}\n slice: {1}\n list(): {2}\n copy(): {3}\n deepcopy(): {4}\n".format(a,b,c,d,e)) diff --git a/2code/22501.py b/2code/22501.py new file mode 100644 index 0000000..b10a271 --- /dev/null +++ b/2code/22501.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# coding=utf-8 + +import urllib + +def go(a,b,c): + per = 100.0 * a * b / c + if per > 100: + per = 100 + print "%.2f%%" % per + +url = "http://youxi.66wz.com/uploads/1046/1321/11410192.90d133701b06f0cc2826c3e5ac34c620.jpg" +local = "/home/qw/Pictures/g.jpg" +urllib.urlretrieve(url, local, go) diff --git a/2code/22601.xml b/2code/22601.xml new file mode 100644 index 0000000..45a12d9 --- /dev/null +++ b/2code/22601.xml @@ -0,0 +1,8 @@ +<bookstore> + <book category="COOKING"> + <title lang="en">Everyday Italian + Giada De Laurentiis + 2005 + 37.0 + + python \ No newline at end of file diff --git a/2code/22701.py b/2code/22701.py new file mode 100644 index 0000000..da09e64 --- /dev/null +++ b/2code/22701.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# coding=utf-8 + +import json + +class Person(object): + def __init__(self,name,age): + self.name = name + self.age = age + + def __repr__(self): + return 'Person Object name : %s , age : %d' % (self.name,self.age) + + +def object2dict(obj): #convert Person to dict + d = {} + d['__class__'] = obj.__class__.__name__ + d['__module__'] = obj.__module__ + d.update(obj.__dict__) + return d + +def dict2object(d): #convert dict ot Person + if '__class__' in d: + class_name = d.pop('__class__') + module_name = d.pop('__module__') + module = __import__(module_name) + class_ = getattr(module, class_name) + args = dict((key.encode('ascii'), value) for key,value in d.items()) #get args + inst = class_(**args) #create new instance + else: + inst = d + return inst + + +if __name__ == '__main__': + p = Person('Peter',40) + print p + d = object2dict(p) + print d + o = dict2object(d) + print type(o), o + + dump = json.dumps(p, default=object2dict) + print dump + load = json.loads(dump, object_hook=dict2object) + print load diff --git a/2code/22901.dat b/2code/22901.dat new file mode 100644 index 0000000..f521265 --- /dev/null +++ b/2code/22901.dat @@ -0,0 +1,7 @@ +(lp0 +I1 +aI2 +aI3 +aI4 +aI5 +a. \ No newline at end of file diff --git a/2code/22901.db b/2code/22901.db new file mode 100644 index 0000000..0fe8ffb Binary files /dev/null and b/2code/22901.db differ diff --git a/2code/22902.dat b/2code/22902.dat new file mode 100644 index 0000000..a950eeb --- /dev/null +++ b/2code/22902.dat @@ -0,0 +1,10004 @@ +(dp0 +S'i' +p1 +(lp2 +I0 +aI1 +aI2 +aI3 +aI4 +aI5 +aI6 +aI7 +aI8 +aI9 +aI10 +aI11 +aI12 +aI13 +aI14 +aI15 +aI16 +aI17 +aI18 +aI19 +aI20 +aI21 +aI22 +aI23 +aI24 +aI25 +aI26 +aI27 +aI28 +aI29 +aI30 +aI31 +aI32 +aI33 +aI34 +aI35 +aI36 +aI37 +aI38 +aI39 +aI40 +aI41 +aI42 +aI43 +aI44 +aI45 +aI46 +aI47 +aI48 +aI49 +aI50 +aI51 +aI52 +aI53 +aI54 +aI55 +aI56 +aI57 +aI58 +aI59 +aI60 +aI61 +aI62 +aI63 +aI64 +aI65 +aI66 +aI67 +aI68 +aI69 +aI70 +aI71 +aI72 +aI73 +aI74 +aI75 +aI76 +aI77 +aI78 +aI79 +aI80 +aI81 +aI82 +aI83 +aI84 +aI85 +aI86 +aI87 +aI88 +aI89 +aI90 +aI91 +aI92 +aI93 +aI94 +aI95 +aI96 +aI97 +aI98 +aI99 +aI100 +aI101 +aI102 +aI103 +aI104 +aI105 +aI106 +aI107 +aI108 +aI109 +aI110 +aI111 +aI112 +aI113 +aI114 +aI115 +aI116 +aI117 +aI118 +aI119 +aI120 +aI121 +aI122 +aI123 +aI124 +aI125 +aI126 +aI127 +aI128 +aI129 +aI130 +aI131 +aI132 +aI133 +aI134 +aI135 +aI136 +aI137 +aI138 +aI139 +aI140 +aI141 +aI142 +aI143 +aI144 +aI145 +aI146 +aI147 +aI148 +aI149 +aI150 +aI151 +aI152 +aI153 +aI154 +aI155 +aI156 +aI157 +aI158 +aI159 +aI160 +aI161 +aI162 +aI163 +aI164 +aI165 +aI166 +aI167 +aI168 +aI169 +aI170 +aI171 +aI172 +aI173 +aI174 +aI175 +aI176 +aI177 +aI178 +aI179 +aI180 +aI181 +aI182 +aI183 +aI184 +aI185 +aI186 +aI187 +aI188 +aI189 +aI190 +aI191 +aI192 +aI193 +aI194 +aI195 +aI196 +aI197 +aI198 +aI199 +aI200 +aI201 +aI202 +aI203 +aI204 +aI205 +aI206 +aI207 +aI208 +aI209 +aI210 +aI211 +aI212 +aI213 +aI214 +aI215 +aI216 +aI217 +aI218 +aI219 +aI220 +aI221 +aI222 +aI223 +aI224 +aI225 +aI226 +aI227 +aI228 +aI229 +aI230 +aI231 +aI232 +aI233 +aI234 +aI235 +aI236 +aI237 +aI238 +aI239 +aI240 +aI241 +aI242 +aI243 +aI244 +aI245 +aI246 +aI247 +aI248 +aI249 +aI250 +aI251 +aI252 +aI253 +aI254 +aI255 +aI256 +aI257 +aI258 +aI259 +aI260 +aI261 +aI262 +aI263 +aI264 +aI265 +aI266 +aI267 +aI268 +aI269 +aI270 +aI271 +aI272 +aI273 +aI274 +aI275 +aI276 +aI277 +aI278 +aI279 +aI280 +aI281 +aI282 +aI283 +aI284 +aI285 +aI286 +aI287 +aI288 +aI289 +aI290 +aI291 +aI292 +aI293 +aI294 +aI295 +aI296 +aI297 +aI298 +aI299 +aI300 +aI301 +aI302 +aI303 +aI304 +aI305 +aI306 +aI307 +aI308 +aI309 +aI310 +aI311 +aI312 +aI313 +aI314 +aI315 +aI316 +aI317 +aI318 +aI319 +aI320 +aI321 +aI322 +aI323 +aI324 +aI325 +aI326 +aI327 +aI328 +aI329 +aI330 +aI331 +aI332 +aI333 +aI334 +aI335 +aI336 +aI337 +aI338 +aI339 +aI340 +aI341 +aI342 +aI343 +aI344 +aI345 +aI346 +aI347 +aI348 +aI349 +aI350 +aI351 +aI352 +aI353 +aI354 +aI355 +aI356 +aI357 +aI358 +aI359 +aI360 +aI361 +aI362 +aI363 +aI364 +aI365 +aI366 +aI367 +aI368 +aI369 +aI370 +aI371 +aI372 +aI373 +aI374 +aI375 +aI376 +aI377 +aI378 +aI379 +aI380 +aI381 +aI382 +aI383 +aI384 +aI385 +aI386 +aI387 +aI388 +aI389 +aI390 +aI391 +aI392 +aI393 +aI394 +aI395 +aI396 +aI397 +aI398 +aI399 +aI400 +aI401 +aI402 +aI403 +aI404 +aI405 +aI406 +aI407 +aI408 +aI409 +aI410 +aI411 +aI412 +aI413 +aI414 +aI415 +aI416 +aI417 +aI418 +aI419 +aI420 +aI421 +aI422 +aI423 +aI424 +aI425 +aI426 +aI427 +aI428 +aI429 +aI430 +aI431 +aI432 +aI433 +aI434 +aI435 +aI436 +aI437 +aI438 +aI439 +aI440 +aI441 +aI442 +aI443 +aI444 +aI445 +aI446 +aI447 +aI448 +aI449 +aI450 +aI451 +aI452 +aI453 +aI454 +aI455 +aI456 +aI457 +aI458 +aI459 +aI460 +aI461 +aI462 +aI463 +aI464 +aI465 +aI466 +aI467 +aI468 +aI469 +aI470 +aI471 +aI472 +aI473 +aI474 +aI475 +aI476 +aI477 +aI478 +aI479 +aI480 +aI481 +aI482 +aI483 +aI484 +aI485 +aI486 +aI487 +aI488 +aI489 +aI490 +aI491 +aI492 +aI493 +aI494 +aI495 +aI496 +aI497 +aI498 +aI499 +aI500 +aI501 +aI502 +aI503 +aI504 +aI505 +aI506 +aI507 +aI508 +aI509 +aI510 +aI511 +aI512 +aI513 +aI514 +aI515 +aI516 +aI517 +aI518 +aI519 +aI520 +aI521 +aI522 +aI523 +aI524 +aI525 +aI526 +aI527 +aI528 +aI529 +aI530 +aI531 +aI532 +aI533 +aI534 +aI535 +aI536 +aI537 +aI538 +aI539 +aI540 +aI541 +aI542 +aI543 +aI544 +aI545 +aI546 +aI547 +aI548 +aI549 +aI550 +aI551 +aI552 +aI553 +aI554 +aI555 +aI556 +aI557 +aI558 +aI559 +aI560 +aI561 +aI562 +aI563 +aI564 +aI565 +aI566 +aI567 +aI568 +aI569 +aI570 +aI571 +aI572 +aI573 +aI574 +aI575 +aI576 +aI577 +aI578 +aI579 +aI580 +aI581 +aI582 +aI583 +aI584 +aI585 +aI586 +aI587 +aI588 +aI589 +aI590 +aI591 +aI592 +aI593 +aI594 +aI595 +aI596 +aI597 +aI598 +aI599 +aI600 +aI601 +aI602 +aI603 +aI604 +aI605 +aI606 +aI607 +aI608 +aI609 +aI610 +aI611 +aI612 +aI613 +aI614 +aI615 +aI616 +aI617 +aI618 +aI619 +aI620 +aI621 +aI622 +aI623 +aI624 +aI625 +aI626 +aI627 +aI628 +aI629 +aI630 +aI631 +aI632 +aI633 +aI634 +aI635 +aI636 +aI637 +aI638 +aI639 +aI640 +aI641 +aI642 +aI643 +aI644 +aI645 +aI646 +aI647 +aI648 +aI649 +aI650 +aI651 +aI652 +aI653 +aI654 +aI655 +aI656 +aI657 +aI658 +aI659 +aI660 +aI661 +aI662 +aI663 +aI664 +aI665 +aI666 +aI667 +aI668 +aI669 +aI670 +aI671 +aI672 +aI673 +aI674 +aI675 +aI676 +aI677 +aI678 +aI679 +aI680 +aI681 +aI682 +aI683 +aI684 +aI685 +aI686 +aI687 +aI688 +aI689 +aI690 +aI691 +aI692 +aI693 +aI694 +aI695 +aI696 +aI697 +aI698 +aI699 +aI700 +aI701 +aI702 +aI703 +aI704 +aI705 +aI706 +aI707 +aI708 +aI709 +aI710 +aI711 +aI712 +aI713 +aI714 +aI715 +aI716 +aI717 +aI718 +aI719 +aI720 +aI721 +aI722 +aI723 +aI724 +aI725 +aI726 +aI727 +aI728 +aI729 +aI730 +aI731 +aI732 +aI733 +aI734 +aI735 +aI736 +aI737 +aI738 +aI739 +aI740 +aI741 +aI742 +aI743 +aI744 +aI745 +aI746 +aI747 +aI748 +aI749 +aI750 +aI751 +aI752 +aI753 +aI754 +aI755 +aI756 +aI757 +aI758 +aI759 +aI760 +aI761 +aI762 +aI763 +aI764 +aI765 +aI766 +aI767 +aI768 +aI769 +aI770 +aI771 +aI772 +aI773 +aI774 +aI775 +aI776 +aI777 +aI778 +aI779 +aI780 +aI781 +aI782 +aI783 +aI784 +aI785 +aI786 +aI787 +aI788 +aI789 +aI790 +aI791 +aI792 +aI793 +aI794 +aI795 +aI796 +aI797 +aI798 +aI799 +aI800 +aI801 +aI802 +aI803 +aI804 +aI805 +aI806 +aI807 +aI808 +aI809 +aI810 +aI811 +aI812 +aI813 +aI814 +aI815 +aI816 +aI817 +aI818 +aI819 +aI820 +aI821 +aI822 +aI823 +aI824 +aI825 +aI826 +aI827 +aI828 +aI829 +aI830 +aI831 +aI832 +aI833 +aI834 +aI835 +aI836 +aI837 +aI838 +aI839 +aI840 +aI841 +aI842 +aI843 +aI844 +aI845 +aI846 +aI847 +aI848 +aI849 +aI850 +aI851 +aI852 +aI853 +aI854 +aI855 +aI856 +aI857 +aI858 +aI859 +aI860 +aI861 +aI862 +aI863 +aI864 +aI865 +aI866 +aI867 +aI868 +aI869 +aI870 +aI871 +aI872 +aI873 +aI874 +aI875 +aI876 +aI877 +aI878 +aI879 +aI880 +aI881 +aI882 +aI883 +aI884 +aI885 +aI886 +aI887 +aI888 +aI889 +aI890 +aI891 +aI892 +aI893 +aI894 +aI895 +aI896 +aI897 +aI898 +aI899 +aI900 +aI901 +aI902 +aI903 +aI904 +aI905 +aI906 +aI907 +aI908 +aI909 +aI910 +aI911 +aI912 +aI913 +aI914 +aI915 +aI916 +aI917 +aI918 +aI919 +aI920 +aI921 +aI922 +aI923 +aI924 +aI925 +aI926 +aI927 +aI928 +aI929 +aI930 +aI931 +aI932 +aI933 +aI934 +aI935 +aI936 +aI937 +aI938 +aI939 +aI940 +aI941 +aI942 +aI943 +aI944 +aI945 +aI946 +aI947 +aI948 +aI949 +aI950 +aI951 +aI952 +aI953 +aI954 +aI955 +aI956 +aI957 +aI958 +aI959 +aI960 +aI961 +aI962 +aI963 +aI964 +aI965 +aI966 +aI967 +aI968 +aI969 +aI970 +aI971 +aI972 +aI973 +aI974 +aI975 +aI976 +aI977 +aI978 +aI979 +aI980 +aI981 +aI982 +aI983 +aI984 +aI985 +aI986 +aI987 +aI988 +aI989 +aI990 +aI991 +aI992 +aI993 +aI994 +aI995 +aI996 +aI997 +aI998 +aI999 +aI1000 +aI1001 +aI1002 +aI1003 +aI1004 +aI1005 +aI1006 +aI1007 +aI1008 +aI1009 +aI1010 +aI1011 +aI1012 +aI1013 +aI1014 +aI1015 +aI1016 +aI1017 +aI1018 +aI1019 +aI1020 +aI1021 +aI1022 +aI1023 +aI1024 +aI1025 +aI1026 +aI1027 +aI1028 +aI1029 +aI1030 +aI1031 +aI1032 +aI1033 +aI1034 +aI1035 +aI1036 +aI1037 +aI1038 +aI1039 +aI1040 +aI1041 +aI1042 +aI1043 +aI1044 +aI1045 +aI1046 +aI1047 +aI1048 +aI1049 +aI1050 +aI1051 +aI1052 +aI1053 +aI1054 +aI1055 +aI1056 +aI1057 +aI1058 +aI1059 +aI1060 +aI1061 +aI1062 +aI1063 +aI1064 +aI1065 +aI1066 +aI1067 +aI1068 +aI1069 +aI1070 +aI1071 +aI1072 +aI1073 +aI1074 +aI1075 +aI1076 +aI1077 +aI1078 +aI1079 +aI1080 +aI1081 +aI1082 +aI1083 +aI1084 +aI1085 +aI1086 +aI1087 +aI1088 +aI1089 +aI1090 +aI1091 +aI1092 +aI1093 +aI1094 +aI1095 +aI1096 +aI1097 +aI1098 +aI1099 +aI1100 +aI1101 +aI1102 +aI1103 +aI1104 +aI1105 +aI1106 +aI1107 +aI1108 +aI1109 +aI1110 +aI1111 +aI1112 +aI1113 +aI1114 +aI1115 +aI1116 +aI1117 +aI1118 +aI1119 +aI1120 +aI1121 +aI1122 +aI1123 +aI1124 +aI1125 +aI1126 +aI1127 +aI1128 +aI1129 +aI1130 +aI1131 +aI1132 +aI1133 +aI1134 +aI1135 +aI1136 +aI1137 +aI1138 +aI1139 +aI1140 +aI1141 +aI1142 +aI1143 +aI1144 +aI1145 +aI1146 +aI1147 +aI1148 +aI1149 +aI1150 +aI1151 +aI1152 +aI1153 +aI1154 +aI1155 +aI1156 +aI1157 +aI1158 +aI1159 +aI1160 +aI1161 +aI1162 +aI1163 +aI1164 +aI1165 +aI1166 +aI1167 +aI1168 +aI1169 +aI1170 +aI1171 +aI1172 +aI1173 +aI1174 +aI1175 +aI1176 +aI1177 +aI1178 +aI1179 +aI1180 +aI1181 +aI1182 +aI1183 +aI1184 +aI1185 +aI1186 +aI1187 +aI1188 +aI1189 +aI1190 +aI1191 +aI1192 +aI1193 +aI1194 +aI1195 +aI1196 +aI1197 +aI1198 +aI1199 +aI1200 +aI1201 +aI1202 +aI1203 +aI1204 +aI1205 +aI1206 +aI1207 +aI1208 +aI1209 +aI1210 +aI1211 +aI1212 +aI1213 +aI1214 +aI1215 +aI1216 +aI1217 +aI1218 +aI1219 +aI1220 +aI1221 +aI1222 +aI1223 +aI1224 +aI1225 +aI1226 +aI1227 +aI1228 +aI1229 +aI1230 +aI1231 +aI1232 +aI1233 +aI1234 +aI1235 +aI1236 +aI1237 +aI1238 +aI1239 +aI1240 +aI1241 +aI1242 +aI1243 +aI1244 +aI1245 +aI1246 +aI1247 +aI1248 +aI1249 +aI1250 +aI1251 +aI1252 +aI1253 +aI1254 +aI1255 +aI1256 +aI1257 +aI1258 +aI1259 +aI1260 +aI1261 +aI1262 +aI1263 +aI1264 +aI1265 +aI1266 +aI1267 +aI1268 +aI1269 +aI1270 +aI1271 +aI1272 +aI1273 +aI1274 +aI1275 +aI1276 +aI1277 +aI1278 +aI1279 +aI1280 +aI1281 +aI1282 +aI1283 +aI1284 +aI1285 +aI1286 +aI1287 +aI1288 +aI1289 +aI1290 +aI1291 +aI1292 +aI1293 +aI1294 +aI1295 +aI1296 +aI1297 +aI1298 +aI1299 +aI1300 +aI1301 +aI1302 +aI1303 +aI1304 +aI1305 +aI1306 +aI1307 +aI1308 +aI1309 +aI1310 +aI1311 +aI1312 +aI1313 +aI1314 +aI1315 +aI1316 +aI1317 +aI1318 +aI1319 +aI1320 +aI1321 +aI1322 +aI1323 +aI1324 +aI1325 +aI1326 +aI1327 +aI1328 +aI1329 +aI1330 +aI1331 +aI1332 +aI1333 +aI1334 +aI1335 +aI1336 +aI1337 +aI1338 +aI1339 +aI1340 +aI1341 +aI1342 +aI1343 +aI1344 +aI1345 +aI1346 +aI1347 +aI1348 +aI1349 +aI1350 +aI1351 +aI1352 +aI1353 +aI1354 +aI1355 +aI1356 +aI1357 +aI1358 +aI1359 +aI1360 +aI1361 +aI1362 +aI1363 +aI1364 +aI1365 +aI1366 +aI1367 +aI1368 +aI1369 +aI1370 +aI1371 +aI1372 +aI1373 +aI1374 +aI1375 +aI1376 +aI1377 +aI1378 +aI1379 +aI1380 +aI1381 +aI1382 +aI1383 +aI1384 +aI1385 +aI1386 +aI1387 +aI1388 +aI1389 +aI1390 +aI1391 +aI1392 +aI1393 +aI1394 +aI1395 +aI1396 +aI1397 +aI1398 +aI1399 +aI1400 +aI1401 +aI1402 +aI1403 +aI1404 +aI1405 +aI1406 +aI1407 +aI1408 +aI1409 +aI1410 +aI1411 +aI1412 +aI1413 +aI1414 +aI1415 +aI1416 +aI1417 +aI1418 +aI1419 +aI1420 +aI1421 +aI1422 +aI1423 +aI1424 +aI1425 +aI1426 +aI1427 +aI1428 +aI1429 +aI1430 +aI1431 +aI1432 +aI1433 +aI1434 +aI1435 +aI1436 +aI1437 +aI1438 +aI1439 +aI1440 +aI1441 +aI1442 +aI1443 +aI1444 +aI1445 +aI1446 +aI1447 +aI1448 +aI1449 +aI1450 +aI1451 +aI1452 +aI1453 +aI1454 +aI1455 +aI1456 +aI1457 +aI1458 +aI1459 +aI1460 +aI1461 +aI1462 +aI1463 +aI1464 +aI1465 +aI1466 +aI1467 +aI1468 +aI1469 +aI1470 +aI1471 +aI1472 +aI1473 +aI1474 +aI1475 +aI1476 +aI1477 +aI1478 +aI1479 +aI1480 +aI1481 +aI1482 +aI1483 +aI1484 +aI1485 +aI1486 +aI1487 +aI1488 +aI1489 +aI1490 +aI1491 +aI1492 +aI1493 +aI1494 +aI1495 +aI1496 +aI1497 +aI1498 +aI1499 +aI1500 +aI1501 +aI1502 +aI1503 +aI1504 +aI1505 +aI1506 +aI1507 +aI1508 +aI1509 +aI1510 +aI1511 +aI1512 +aI1513 +aI1514 +aI1515 +aI1516 +aI1517 +aI1518 +aI1519 +aI1520 +aI1521 +aI1522 +aI1523 +aI1524 +aI1525 +aI1526 +aI1527 +aI1528 +aI1529 +aI1530 +aI1531 +aI1532 +aI1533 +aI1534 +aI1535 +aI1536 +aI1537 +aI1538 +aI1539 +aI1540 +aI1541 +aI1542 +aI1543 +aI1544 +aI1545 +aI1546 +aI1547 +aI1548 +aI1549 +aI1550 +aI1551 +aI1552 +aI1553 +aI1554 +aI1555 +aI1556 +aI1557 +aI1558 +aI1559 +aI1560 +aI1561 +aI1562 +aI1563 +aI1564 +aI1565 +aI1566 +aI1567 +aI1568 +aI1569 +aI1570 +aI1571 +aI1572 +aI1573 +aI1574 +aI1575 +aI1576 +aI1577 +aI1578 +aI1579 +aI1580 +aI1581 +aI1582 +aI1583 +aI1584 +aI1585 +aI1586 +aI1587 +aI1588 +aI1589 +aI1590 +aI1591 +aI1592 +aI1593 +aI1594 +aI1595 +aI1596 +aI1597 +aI1598 +aI1599 +aI1600 +aI1601 +aI1602 +aI1603 +aI1604 +aI1605 +aI1606 +aI1607 +aI1608 +aI1609 +aI1610 +aI1611 +aI1612 +aI1613 +aI1614 +aI1615 +aI1616 +aI1617 +aI1618 +aI1619 +aI1620 +aI1621 +aI1622 +aI1623 +aI1624 +aI1625 +aI1626 +aI1627 +aI1628 +aI1629 +aI1630 +aI1631 +aI1632 +aI1633 +aI1634 +aI1635 +aI1636 +aI1637 +aI1638 +aI1639 +aI1640 +aI1641 +aI1642 +aI1643 +aI1644 +aI1645 +aI1646 +aI1647 +aI1648 +aI1649 +aI1650 +aI1651 +aI1652 +aI1653 +aI1654 +aI1655 +aI1656 +aI1657 +aI1658 +aI1659 +aI1660 +aI1661 +aI1662 +aI1663 +aI1664 +aI1665 +aI1666 +aI1667 +aI1668 +aI1669 +aI1670 +aI1671 +aI1672 +aI1673 +aI1674 +aI1675 +aI1676 +aI1677 +aI1678 +aI1679 +aI1680 +aI1681 +aI1682 +aI1683 +aI1684 +aI1685 +aI1686 +aI1687 +aI1688 +aI1689 +aI1690 +aI1691 +aI1692 +aI1693 +aI1694 +aI1695 +aI1696 +aI1697 +aI1698 +aI1699 +aI1700 +aI1701 +aI1702 +aI1703 +aI1704 +aI1705 +aI1706 +aI1707 +aI1708 +aI1709 +aI1710 +aI1711 +aI1712 +aI1713 +aI1714 +aI1715 +aI1716 +aI1717 +aI1718 +aI1719 +aI1720 +aI1721 +aI1722 +aI1723 +aI1724 +aI1725 +aI1726 +aI1727 +aI1728 +aI1729 +aI1730 +aI1731 +aI1732 +aI1733 +aI1734 +aI1735 +aI1736 +aI1737 +aI1738 +aI1739 +aI1740 +aI1741 +aI1742 +aI1743 +aI1744 +aI1745 +aI1746 +aI1747 +aI1748 +aI1749 +aI1750 +aI1751 +aI1752 +aI1753 +aI1754 +aI1755 +aI1756 +aI1757 +aI1758 +aI1759 +aI1760 +aI1761 +aI1762 +aI1763 +aI1764 +aI1765 +aI1766 +aI1767 +aI1768 +aI1769 +aI1770 +aI1771 +aI1772 +aI1773 +aI1774 +aI1775 +aI1776 +aI1777 +aI1778 +aI1779 +aI1780 +aI1781 +aI1782 +aI1783 +aI1784 +aI1785 +aI1786 +aI1787 +aI1788 +aI1789 +aI1790 +aI1791 +aI1792 +aI1793 +aI1794 +aI1795 +aI1796 +aI1797 +aI1798 +aI1799 +aI1800 +aI1801 +aI1802 +aI1803 +aI1804 +aI1805 +aI1806 +aI1807 +aI1808 +aI1809 +aI1810 +aI1811 +aI1812 +aI1813 +aI1814 +aI1815 +aI1816 +aI1817 +aI1818 +aI1819 +aI1820 +aI1821 +aI1822 +aI1823 +aI1824 +aI1825 +aI1826 +aI1827 +aI1828 +aI1829 +aI1830 +aI1831 +aI1832 +aI1833 +aI1834 +aI1835 +aI1836 +aI1837 +aI1838 +aI1839 +aI1840 +aI1841 +aI1842 +aI1843 +aI1844 +aI1845 +aI1846 +aI1847 +aI1848 +aI1849 +aI1850 +aI1851 +aI1852 +aI1853 +aI1854 +aI1855 +aI1856 +aI1857 +aI1858 +aI1859 +aI1860 +aI1861 +aI1862 +aI1863 +aI1864 +aI1865 +aI1866 +aI1867 +aI1868 +aI1869 +aI1870 +aI1871 +aI1872 +aI1873 +aI1874 +aI1875 +aI1876 +aI1877 +aI1878 +aI1879 +aI1880 +aI1881 +aI1882 +aI1883 +aI1884 +aI1885 +aI1886 +aI1887 +aI1888 +aI1889 +aI1890 +aI1891 +aI1892 +aI1893 +aI1894 +aI1895 +aI1896 +aI1897 +aI1898 +aI1899 +aI1900 +aI1901 +aI1902 +aI1903 +aI1904 +aI1905 +aI1906 +aI1907 +aI1908 +aI1909 +aI1910 +aI1911 +aI1912 +aI1913 +aI1914 +aI1915 +aI1916 +aI1917 +aI1918 +aI1919 +aI1920 +aI1921 +aI1922 +aI1923 +aI1924 +aI1925 +aI1926 +aI1927 +aI1928 +aI1929 +aI1930 +aI1931 +aI1932 +aI1933 +aI1934 +aI1935 +aI1936 +aI1937 +aI1938 +aI1939 +aI1940 +aI1941 +aI1942 +aI1943 +aI1944 +aI1945 +aI1946 +aI1947 +aI1948 +aI1949 +aI1950 +aI1951 +aI1952 +aI1953 +aI1954 +aI1955 +aI1956 +aI1957 +aI1958 +aI1959 +aI1960 +aI1961 +aI1962 +aI1963 +aI1964 +aI1965 +aI1966 +aI1967 +aI1968 +aI1969 +aI1970 +aI1971 +aI1972 +aI1973 +aI1974 +aI1975 +aI1976 +aI1977 +aI1978 +aI1979 +aI1980 +aI1981 +aI1982 +aI1983 +aI1984 +aI1985 +aI1986 +aI1987 +aI1988 +aI1989 +aI1990 +aI1991 +aI1992 +aI1993 +aI1994 +aI1995 +aI1996 +aI1997 +aI1998 +aI1999 +aI2000 +aI2001 +aI2002 +aI2003 +aI2004 +aI2005 +aI2006 +aI2007 +aI2008 +aI2009 +aI2010 +aI2011 +aI2012 +aI2013 +aI2014 +aI2015 +aI2016 +aI2017 +aI2018 +aI2019 +aI2020 +aI2021 +aI2022 +aI2023 +aI2024 +aI2025 +aI2026 +aI2027 +aI2028 +aI2029 +aI2030 +aI2031 +aI2032 +aI2033 +aI2034 +aI2035 +aI2036 +aI2037 +aI2038 +aI2039 +aI2040 +aI2041 +aI2042 +aI2043 +aI2044 +aI2045 +aI2046 +aI2047 +aI2048 +aI2049 +aI2050 +aI2051 +aI2052 +aI2053 +aI2054 +aI2055 +aI2056 +aI2057 +aI2058 +aI2059 +aI2060 +aI2061 +aI2062 +aI2063 +aI2064 +aI2065 +aI2066 +aI2067 +aI2068 +aI2069 +aI2070 +aI2071 +aI2072 +aI2073 +aI2074 +aI2075 +aI2076 +aI2077 +aI2078 +aI2079 +aI2080 +aI2081 +aI2082 +aI2083 +aI2084 +aI2085 +aI2086 +aI2087 +aI2088 +aI2089 +aI2090 +aI2091 +aI2092 +aI2093 +aI2094 +aI2095 +aI2096 +aI2097 +aI2098 +aI2099 +aI2100 +aI2101 +aI2102 +aI2103 +aI2104 +aI2105 +aI2106 +aI2107 +aI2108 +aI2109 +aI2110 +aI2111 +aI2112 +aI2113 +aI2114 +aI2115 +aI2116 +aI2117 +aI2118 +aI2119 +aI2120 +aI2121 +aI2122 +aI2123 +aI2124 +aI2125 +aI2126 +aI2127 +aI2128 +aI2129 +aI2130 +aI2131 +aI2132 +aI2133 +aI2134 +aI2135 +aI2136 +aI2137 +aI2138 +aI2139 +aI2140 +aI2141 +aI2142 +aI2143 +aI2144 +aI2145 +aI2146 +aI2147 +aI2148 +aI2149 +aI2150 +aI2151 +aI2152 +aI2153 +aI2154 +aI2155 +aI2156 +aI2157 +aI2158 +aI2159 +aI2160 +aI2161 +aI2162 +aI2163 +aI2164 +aI2165 +aI2166 +aI2167 +aI2168 +aI2169 +aI2170 +aI2171 +aI2172 +aI2173 +aI2174 +aI2175 +aI2176 +aI2177 +aI2178 +aI2179 +aI2180 +aI2181 +aI2182 +aI2183 +aI2184 +aI2185 +aI2186 +aI2187 +aI2188 +aI2189 +aI2190 +aI2191 +aI2192 +aI2193 +aI2194 +aI2195 +aI2196 +aI2197 +aI2198 +aI2199 +aI2200 +aI2201 +aI2202 +aI2203 +aI2204 +aI2205 +aI2206 +aI2207 +aI2208 +aI2209 +aI2210 +aI2211 +aI2212 +aI2213 +aI2214 +aI2215 +aI2216 +aI2217 +aI2218 +aI2219 +aI2220 +aI2221 +aI2222 +aI2223 +aI2224 +aI2225 +aI2226 +aI2227 +aI2228 +aI2229 +aI2230 +aI2231 +aI2232 +aI2233 +aI2234 +aI2235 +aI2236 +aI2237 +aI2238 +aI2239 +aI2240 +aI2241 +aI2242 +aI2243 +aI2244 +aI2245 +aI2246 +aI2247 +aI2248 +aI2249 +aI2250 +aI2251 +aI2252 +aI2253 +aI2254 +aI2255 +aI2256 +aI2257 +aI2258 +aI2259 +aI2260 +aI2261 +aI2262 +aI2263 +aI2264 +aI2265 +aI2266 +aI2267 +aI2268 +aI2269 +aI2270 +aI2271 +aI2272 +aI2273 +aI2274 +aI2275 +aI2276 +aI2277 +aI2278 +aI2279 +aI2280 +aI2281 +aI2282 +aI2283 +aI2284 +aI2285 +aI2286 +aI2287 +aI2288 +aI2289 +aI2290 +aI2291 +aI2292 +aI2293 +aI2294 +aI2295 +aI2296 +aI2297 +aI2298 +aI2299 +aI2300 +aI2301 +aI2302 +aI2303 +aI2304 +aI2305 +aI2306 +aI2307 +aI2308 +aI2309 +aI2310 +aI2311 +aI2312 +aI2313 +aI2314 +aI2315 +aI2316 +aI2317 +aI2318 +aI2319 +aI2320 +aI2321 +aI2322 +aI2323 +aI2324 +aI2325 +aI2326 +aI2327 +aI2328 +aI2329 +aI2330 +aI2331 +aI2332 +aI2333 +aI2334 +aI2335 +aI2336 +aI2337 +aI2338 +aI2339 +aI2340 +aI2341 +aI2342 +aI2343 +aI2344 +aI2345 +aI2346 +aI2347 +aI2348 +aI2349 +aI2350 +aI2351 +aI2352 +aI2353 +aI2354 +aI2355 +aI2356 +aI2357 +aI2358 +aI2359 +aI2360 +aI2361 +aI2362 +aI2363 +aI2364 +aI2365 +aI2366 +aI2367 +aI2368 +aI2369 +aI2370 +aI2371 +aI2372 +aI2373 +aI2374 +aI2375 +aI2376 +aI2377 +aI2378 +aI2379 +aI2380 +aI2381 +aI2382 +aI2383 +aI2384 +aI2385 +aI2386 +aI2387 +aI2388 +aI2389 +aI2390 +aI2391 +aI2392 +aI2393 +aI2394 +aI2395 +aI2396 +aI2397 +aI2398 +aI2399 +aI2400 +aI2401 +aI2402 +aI2403 +aI2404 +aI2405 +aI2406 +aI2407 +aI2408 +aI2409 +aI2410 +aI2411 +aI2412 +aI2413 +aI2414 +aI2415 +aI2416 +aI2417 +aI2418 +aI2419 +aI2420 +aI2421 +aI2422 +aI2423 +aI2424 +aI2425 +aI2426 +aI2427 +aI2428 +aI2429 +aI2430 +aI2431 +aI2432 +aI2433 +aI2434 +aI2435 +aI2436 +aI2437 +aI2438 +aI2439 +aI2440 +aI2441 +aI2442 +aI2443 +aI2444 +aI2445 +aI2446 +aI2447 +aI2448 +aI2449 +aI2450 +aI2451 +aI2452 +aI2453 +aI2454 +aI2455 +aI2456 +aI2457 +aI2458 +aI2459 +aI2460 +aI2461 +aI2462 +aI2463 +aI2464 +aI2465 +aI2466 +aI2467 +aI2468 +aI2469 +aI2470 +aI2471 +aI2472 +aI2473 +aI2474 +aI2475 +aI2476 +aI2477 +aI2478 +aI2479 +aI2480 +aI2481 +aI2482 +aI2483 +aI2484 +aI2485 +aI2486 +aI2487 +aI2488 +aI2489 +aI2490 +aI2491 +aI2492 +aI2493 +aI2494 +aI2495 +aI2496 +aI2497 +aI2498 +aI2499 +aI2500 +aI2501 +aI2502 +aI2503 +aI2504 +aI2505 +aI2506 +aI2507 +aI2508 +aI2509 +aI2510 +aI2511 +aI2512 +aI2513 +aI2514 +aI2515 +aI2516 +aI2517 +aI2518 +aI2519 +aI2520 +aI2521 +aI2522 +aI2523 +aI2524 +aI2525 +aI2526 +aI2527 +aI2528 +aI2529 +aI2530 +aI2531 +aI2532 +aI2533 +aI2534 +aI2535 +aI2536 +aI2537 +aI2538 +aI2539 +aI2540 +aI2541 +aI2542 +aI2543 +aI2544 +aI2545 +aI2546 +aI2547 +aI2548 +aI2549 +aI2550 +aI2551 +aI2552 +aI2553 +aI2554 +aI2555 +aI2556 +aI2557 +aI2558 +aI2559 +aI2560 +aI2561 +aI2562 +aI2563 +aI2564 +aI2565 +aI2566 +aI2567 +aI2568 +aI2569 +aI2570 +aI2571 +aI2572 +aI2573 +aI2574 +aI2575 +aI2576 +aI2577 +aI2578 +aI2579 +aI2580 +aI2581 +aI2582 +aI2583 +aI2584 +aI2585 +aI2586 +aI2587 +aI2588 +aI2589 +aI2590 +aI2591 +aI2592 +aI2593 +aI2594 +aI2595 +aI2596 +aI2597 +aI2598 +aI2599 +aI2600 +aI2601 +aI2602 +aI2603 +aI2604 +aI2605 +aI2606 +aI2607 +aI2608 +aI2609 +aI2610 +aI2611 +aI2612 +aI2613 +aI2614 +aI2615 +aI2616 +aI2617 +aI2618 +aI2619 +aI2620 +aI2621 +aI2622 +aI2623 +aI2624 +aI2625 +aI2626 +aI2627 +aI2628 +aI2629 +aI2630 +aI2631 +aI2632 +aI2633 +aI2634 +aI2635 +aI2636 +aI2637 +aI2638 +aI2639 +aI2640 +aI2641 +aI2642 +aI2643 +aI2644 +aI2645 +aI2646 +aI2647 +aI2648 +aI2649 +aI2650 +aI2651 +aI2652 +aI2653 +aI2654 +aI2655 +aI2656 +aI2657 +aI2658 +aI2659 +aI2660 +aI2661 +aI2662 +aI2663 +aI2664 +aI2665 +aI2666 +aI2667 +aI2668 +aI2669 +aI2670 +aI2671 +aI2672 +aI2673 +aI2674 +aI2675 +aI2676 +aI2677 +aI2678 +aI2679 +aI2680 +aI2681 +aI2682 +aI2683 +aI2684 +aI2685 +aI2686 +aI2687 +aI2688 +aI2689 +aI2690 +aI2691 +aI2692 +aI2693 +aI2694 +aI2695 +aI2696 +aI2697 +aI2698 +aI2699 +aI2700 +aI2701 +aI2702 +aI2703 +aI2704 +aI2705 +aI2706 +aI2707 +aI2708 +aI2709 +aI2710 +aI2711 +aI2712 +aI2713 +aI2714 +aI2715 +aI2716 +aI2717 +aI2718 +aI2719 +aI2720 +aI2721 +aI2722 +aI2723 +aI2724 +aI2725 +aI2726 +aI2727 +aI2728 +aI2729 +aI2730 +aI2731 +aI2732 +aI2733 +aI2734 +aI2735 +aI2736 +aI2737 +aI2738 +aI2739 +aI2740 +aI2741 +aI2742 +aI2743 +aI2744 +aI2745 +aI2746 +aI2747 +aI2748 +aI2749 +aI2750 +aI2751 +aI2752 +aI2753 +aI2754 +aI2755 +aI2756 +aI2757 +aI2758 +aI2759 +aI2760 +aI2761 +aI2762 +aI2763 +aI2764 +aI2765 +aI2766 +aI2767 +aI2768 +aI2769 +aI2770 +aI2771 +aI2772 +aI2773 +aI2774 +aI2775 +aI2776 +aI2777 +aI2778 +aI2779 +aI2780 +aI2781 +aI2782 +aI2783 +aI2784 +aI2785 +aI2786 +aI2787 +aI2788 +aI2789 +aI2790 +aI2791 +aI2792 +aI2793 +aI2794 +aI2795 +aI2796 +aI2797 +aI2798 +aI2799 +aI2800 +aI2801 +aI2802 +aI2803 +aI2804 +aI2805 +aI2806 +aI2807 +aI2808 +aI2809 +aI2810 +aI2811 +aI2812 +aI2813 +aI2814 +aI2815 +aI2816 +aI2817 +aI2818 +aI2819 +aI2820 +aI2821 +aI2822 +aI2823 +aI2824 +aI2825 +aI2826 +aI2827 +aI2828 +aI2829 +aI2830 +aI2831 +aI2832 +aI2833 +aI2834 +aI2835 +aI2836 +aI2837 +aI2838 +aI2839 +aI2840 +aI2841 +aI2842 +aI2843 +aI2844 +aI2845 +aI2846 +aI2847 +aI2848 +aI2849 +aI2850 +aI2851 +aI2852 +aI2853 +aI2854 +aI2855 +aI2856 +aI2857 +aI2858 +aI2859 +aI2860 +aI2861 +aI2862 +aI2863 +aI2864 +aI2865 +aI2866 +aI2867 +aI2868 +aI2869 +aI2870 +aI2871 +aI2872 +aI2873 +aI2874 +aI2875 +aI2876 +aI2877 +aI2878 +aI2879 +aI2880 +aI2881 +aI2882 +aI2883 +aI2884 +aI2885 +aI2886 +aI2887 +aI2888 +aI2889 +aI2890 +aI2891 +aI2892 +aI2893 +aI2894 +aI2895 +aI2896 +aI2897 +aI2898 +aI2899 +aI2900 +aI2901 +aI2902 +aI2903 +aI2904 +aI2905 +aI2906 +aI2907 +aI2908 +aI2909 +aI2910 +aI2911 +aI2912 +aI2913 +aI2914 +aI2915 +aI2916 +aI2917 +aI2918 +aI2919 +aI2920 +aI2921 +aI2922 +aI2923 +aI2924 +aI2925 +aI2926 +aI2927 +aI2928 +aI2929 +aI2930 +aI2931 +aI2932 +aI2933 +aI2934 +aI2935 +aI2936 +aI2937 +aI2938 +aI2939 +aI2940 +aI2941 +aI2942 +aI2943 +aI2944 +aI2945 +aI2946 +aI2947 +aI2948 +aI2949 +aI2950 +aI2951 +aI2952 +aI2953 +aI2954 +aI2955 +aI2956 +aI2957 +aI2958 +aI2959 +aI2960 +aI2961 +aI2962 +aI2963 +aI2964 +aI2965 +aI2966 +aI2967 +aI2968 +aI2969 +aI2970 +aI2971 +aI2972 +aI2973 +aI2974 +aI2975 +aI2976 +aI2977 +aI2978 +aI2979 +aI2980 +aI2981 +aI2982 +aI2983 +aI2984 +aI2985 +aI2986 +aI2987 +aI2988 +aI2989 +aI2990 +aI2991 +aI2992 +aI2993 +aI2994 +aI2995 +aI2996 +aI2997 +aI2998 +aI2999 +aI3000 +aI3001 +aI3002 +aI3003 +aI3004 +aI3005 +aI3006 +aI3007 +aI3008 +aI3009 +aI3010 +aI3011 +aI3012 +aI3013 +aI3014 +aI3015 +aI3016 +aI3017 +aI3018 +aI3019 +aI3020 +aI3021 +aI3022 +aI3023 +aI3024 +aI3025 +aI3026 +aI3027 +aI3028 +aI3029 +aI3030 +aI3031 +aI3032 +aI3033 +aI3034 +aI3035 +aI3036 +aI3037 +aI3038 +aI3039 +aI3040 +aI3041 +aI3042 +aI3043 +aI3044 +aI3045 +aI3046 +aI3047 +aI3048 +aI3049 +aI3050 +aI3051 +aI3052 +aI3053 +aI3054 +aI3055 +aI3056 +aI3057 +aI3058 +aI3059 +aI3060 +aI3061 +aI3062 +aI3063 +aI3064 +aI3065 +aI3066 +aI3067 +aI3068 +aI3069 +aI3070 +aI3071 +aI3072 +aI3073 +aI3074 +aI3075 +aI3076 +aI3077 +aI3078 +aI3079 +aI3080 +aI3081 +aI3082 +aI3083 +aI3084 +aI3085 +aI3086 +aI3087 +aI3088 +aI3089 +aI3090 +aI3091 +aI3092 +aI3093 +aI3094 +aI3095 +aI3096 +aI3097 +aI3098 +aI3099 +aI3100 +aI3101 +aI3102 +aI3103 +aI3104 +aI3105 +aI3106 +aI3107 +aI3108 +aI3109 +aI3110 +aI3111 +aI3112 +aI3113 +aI3114 +aI3115 +aI3116 +aI3117 +aI3118 +aI3119 +aI3120 +aI3121 +aI3122 +aI3123 +aI3124 +aI3125 +aI3126 +aI3127 +aI3128 +aI3129 +aI3130 +aI3131 +aI3132 +aI3133 +aI3134 +aI3135 +aI3136 +aI3137 +aI3138 +aI3139 +aI3140 +aI3141 +aI3142 +aI3143 +aI3144 +aI3145 +aI3146 +aI3147 +aI3148 +aI3149 +aI3150 +aI3151 +aI3152 +aI3153 +aI3154 +aI3155 +aI3156 +aI3157 +aI3158 +aI3159 +aI3160 +aI3161 +aI3162 +aI3163 +aI3164 +aI3165 +aI3166 +aI3167 +aI3168 +aI3169 +aI3170 +aI3171 +aI3172 +aI3173 +aI3174 +aI3175 +aI3176 +aI3177 +aI3178 +aI3179 +aI3180 +aI3181 +aI3182 +aI3183 +aI3184 +aI3185 +aI3186 +aI3187 +aI3188 +aI3189 +aI3190 +aI3191 +aI3192 +aI3193 +aI3194 +aI3195 +aI3196 +aI3197 +aI3198 +aI3199 +aI3200 +aI3201 +aI3202 +aI3203 +aI3204 +aI3205 +aI3206 +aI3207 +aI3208 +aI3209 +aI3210 +aI3211 +aI3212 +aI3213 +aI3214 +aI3215 +aI3216 +aI3217 +aI3218 +aI3219 +aI3220 +aI3221 +aI3222 +aI3223 +aI3224 +aI3225 +aI3226 +aI3227 +aI3228 +aI3229 +aI3230 +aI3231 +aI3232 +aI3233 +aI3234 +aI3235 +aI3236 +aI3237 +aI3238 +aI3239 +aI3240 +aI3241 +aI3242 +aI3243 +aI3244 +aI3245 +aI3246 +aI3247 +aI3248 +aI3249 +aI3250 +aI3251 +aI3252 +aI3253 +aI3254 +aI3255 +aI3256 +aI3257 +aI3258 +aI3259 +aI3260 +aI3261 +aI3262 +aI3263 +aI3264 +aI3265 +aI3266 +aI3267 +aI3268 +aI3269 +aI3270 +aI3271 +aI3272 +aI3273 +aI3274 +aI3275 +aI3276 +aI3277 +aI3278 +aI3279 +aI3280 +aI3281 +aI3282 +aI3283 +aI3284 +aI3285 +aI3286 +aI3287 +aI3288 +aI3289 +aI3290 +aI3291 +aI3292 +aI3293 +aI3294 +aI3295 +aI3296 +aI3297 +aI3298 +aI3299 +aI3300 +aI3301 +aI3302 +aI3303 +aI3304 +aI3305 +aI3306 +aI3307 +aI3308 +aI3309 +aI3310 +aI3311 +aI3312 +aI3313 +aI3314 +aI3315 +aI3316 +aI3317 +aI3318 +aI3319 +aI3320 +aI3321 +aI3322 +aI3323 +aI3324 +aI3325 +aI3326 +aI3327 +aI3328 +aI3329 +aI3330 +aI3331 +aI3332 +aI3333 +aI3334 +aI3335 +aI3336 +aI3337 +aI3338 +aI3339 +aI3340 +aI3341 +aI3342 +aI3343 +aI3344 +aI3345 +aI3346 +aI3347 +aI3348 +aI3349 +aI3350 +aI3351 +aI3352 +aI3353 +aI3354 +aI3355 +aI3356 +aI3357 +aI3358 +aI3359 +aI3360 +aI3361 +aI3362 +aI3363 +aI3364 +aI3365 +aI3366 +aI3367 +aI3368 +aI3369 +aI3370 +aI3371 +aI3372 +aI3373 +aI3374 +aI3375 +aI3376 +aI3377 +aI3378 +aI3379 +aI3380 +aI3381 +aI3382 +aI3383 +aI3384 +aI3385 +aI3386 +aI3387 +aI3388 +aI3389 +aI3390 +aI3391 +aI3392 +aI3393 +aI3394 +aI3395 +aI3396 +aI3397 +aI3398 +aI3399 +aI3400 +aI3401 +aI3402 +aI3403 +aI3404 +aI3405 +aI3406 +aI3407 +aI3408 +aI3409 +aI3410 +aI3411 +aI3412 +aI3413 +aI3414 +aI3415 +aI3416 +aI3417 +aI3418 +aI3419 +aI3420 +aI3421 +aI3422 +aI3423 +aI3424 +aI3425 +aI3426 +aI3427 +aI3428 +aI3429 +aI3430 +aI3431 +aI3432 +aI3433 +aI3434 +aI3435 +aI3436 +aI3437 +aI3438 +aI3439 +aI3440 +aI3441 +aI3442 +aI3443 +aI3444 +aI3445 +aI3446 +aI3447 +aI3448 +aI3449 +aI3450 +aI3451 +aI3452 +aI3453 +aI3454 +aI3455 +aI3456 +aI3457 +aI3458 +aI3459 +aI3460 +aI3461 +aI3462 +aI3463 +aI3464 +aI3465 +aI3466 +aI3467 +aI3468 +aI3469 +aI3470 +aI3471 +aI3472 +aI3473 +aI3474 +aI3475 +aI3476 +aI3477 +aI3478 +aI3479 +aI3480 +aI3481 +aI3482 +aI3483 +aI3484 +aI3485 +aI3486 +aI3487 +aI3488 +aI3489 +aI3490 +aI3491 +aI3492 +aI3493 +aI3494 +aI3495 +aI3496 +aI3497 +aI3498 +aI3499 +aI3500 +aI3501 +aI3502 +aI3503 +aI3504 +aI3505 +aI3506 +aI3507 +aI3508 +aI3509 +aI3510 +aI3511 +aI3512 +aI3513 +aI3514 +aI3515 +aI3516 +aI3517 +aI3518 +aI3519 +aI3520 +aI3521 +aI3522 +aI3523 +aI3524 +aI3525 +aI3526 +aI3527 +aI3528 +aI3529 +aI3530 +aI3531 +aI3532 +aI3533 +aI3534 +aI3535 +aI3536 +aI3537 +aI3538 +aI3539 +aI3540 +aI3541 +aI3542 +aI3543 +aI3544 +aI3545 +aI3546 +aI3547 +aI3548 +aI3549 +aI3550 +aI3551 +aI3552 +aI3553 +aI3554 +aI3555 +aI3556 +aI3557 +aI3558 +aI3559 +aI3560 +aI3561 +aI3562 +aI3563 +aI3564 +aI3565 +aI3566 +aI3567 +aI3568 +aI3569 +aI3570 +aI3571 +aI3572 +aI3573 +aI3574 +aI3575 +aI3576 +aI3577 +aI3578 +aI3579 +aI3580 +aI3581 +aI3582 +aI3583 +aI3584 +aI3585 +aI3586 +aI3587 +aI3588 +aI3589 +aI3590 +aI3591 +aI3592 +aI3593 +aI3594 +aI3595 +aI3596 +aI3597 +aI3598 +aI3599 +aI3600 +aI3601 +aI3602 +aI3603 +aI3604 +aI3605 +aI3606 +aI3607 +aI3608 +aI3609 +aI3610 +aI3611 +aI3612 +aI3613 +aI3614 +aI3615 +aI3616 +aI3617 +aI3618 +aI3619 +aI3620 +aI3621 +aI3622 +aI3623 +aI3624 +aI3625 +aI3626 +aI3627 +aI3628 +aI3629 +aI3630 +aI3631 +aI3632 +aI3633 +aI3634 +aI3635 +aI3636 +aI3637 +aI3638 +aI3639 +aI3640 +aI3641 +aI3642 +aI3643 +aI3644 +aI3645 +aI3646 +aI3647 +aI3648 +aI3649 +aI3650 +aI3651 +aI3652 +aI3653 +aI3654 +aI3655 +aI3656 +aI3657 +aI3658 +aI3659 +aI3660 +aI3661 +aI3662 +aI3663 +aI3664 +aI3665 +aI3666 +aI3667 +aI3668 +aI3669 +aI3670 +aI3671 +aI3672 +aI3673 +aI3674 +aI3675 +aI3676 +aI3677 +aI3678 +aI3679 +aI3680 +aI3681 +aI3682 +aI3683 +aI3684 +aI3685 +aI3686 +aI3687 +aI3688 +aI3689 +aI3690 +aI3691 +aI3692 +aI3693 +aI3694 +aI3695 +aI3696 +aI3697 +aI3698 +aI3699 +aI3700 +aI3701 +aI3702 +aI3703 +aI3704 +aI3705 +aI3706 +aI3707 +aI3708 +aI3709 +aI3710 +aI3711 +aI3712 +aI3713 +aI3714 +aI3715 +aI3716 +aI3717 +aI3718 +aI3719 +aI3720 +aI3721 +aI3722 +aI3723 +aI3724 +aI3725 +aI3726 +aI3727 +aI3728 +aI3729 +aI3730 +aI3731 +aI3732 +aI3733 +aI3734 +aI3735 +aI3736 +aI3737 +aI3738 +aI3739 +aI3740 +aI3741 +aI3742 +aI3743 +aI3744 +aI3745 +aI3746 +aI3747 +aI3748 +aI3749 +aI3750 +aI3751 +aI3752 +aI3753 +aI3754 +aI3755 +aI3756 +aI3757 +aI3758 +aI3759 +aI3760 +aI3761 +aI3762 +aI3763 +aI3764 +aI3765 +aI3766 +aI3767 +aI3768 +aI3769 +aI3770 +aI3771 +aI3772 +aI3773 +aI3774 +aI3775 +aI3776 +aI3777 +aI3778 +aI3779 +aI3780 +aI3781 +aI3782 +aI3783 +aI3784 +aI3785 +aI3786 +aI3787 +aI3788 +aI3789 +aI3790 +aI3791 +aI3792 +aI3793 +aI3794 +aI3795 +aI3796 +aI3797 +aI3798 +aI3799 +aI3800 +aI3801 +aI3802 +aI3803 +aI3804 +aI3805 +aI3806 +aI3807 +aI3808 +aI3809 +aI3810 +aI3811 +aI3812 +aI3813 +aI3814 +aI3815 +aI3816 +aI3817 +aI3818 +aI3819 +aI3820 +aI3821 +aI3822 +aI3823 +aI3824 +aI3825 +aI3826 +aI3827 +aI3828 +aI3829 +aI3830 +aI3831 +aI3832 +aI3833 +aI3834 +aI3835 +aI3836 +aI3837 +aI3838 +aI3839 +aI3840 +aI3841 +aI3842 +aI3843 +aI3844 +aI3845 +aI3846 +aI3847 +aI3848 +aI3849 +aI3850 +aI3851 +aI3852 +aI3853 +aI3854 +aI3855 +aI3856 +aI3857 +aI3858 +aI3859 +aI3860 +aI3861 +aI3862 +aI3863 +aI3864 +aI3865 +aI3866 +aI3867 +aI3868 +aI3869 +aI3870 +aI3871 +aI3872 +aI3873 +aI3874 +aI3875 +aI3876 +aI3877 +aI3878 +aI3879 +aI3880 +aI3881 +aI3882 +aI3883 +aI3884 +aI3885 +aI3886 +aI3887 +aI3888 +aI3889 +aI3890 +aI3891 +aI3892 +aI3893 +aI3894 +aI3895 +aI3896 +aI3897 +aI3898 +aI3899 +aI3900 +aI3901 +aI3902 +aI3903 +aI3904 +aI3905 +aI3906 +aI3907 +aI3908 +aI3909 +aI3910 +aI3911 +aI3912 +aI3913 +aI3914 +aI3915 +aI3916 +aI3917 +aI3918 +aI3919 +aI3920 +aI3921 +aI3922 +aI3923 +aI3924 +aI3925 +aI3926 +aI3927 +aI3928 +aI3929 +aI3930 +aI3931 +aI3932 +aI3933 +aI3934 +aI3935 +aI3936 +aI3937 +aI3938 +aI3939 +aI3940 +aI3941 +aI3942 +aI3943 +aI3944 +aI3945 +aI3946 +aI3947 +aI3948 +aI3949 +aI3950 +aI3951 +aI3952 +aI3953 +aI3954 +aI3955 +aI3956 +aI3957 +aI3958 +aI3959 +aI3960 +aI3961 +aI3962 +aI3963 +aI3964 +aI3965 +aI3966 +aI3967 +aI3968 +aI3969 +aI3970 +aI3971 +aI3972 +aI3973 +aI3974 +aI3975 +aI3976 +aI3977 +aI3978 +aI3979 +aI3980 +aI3981 +aI3982 +aI3983 +aI3984 +aI3985 +aI3986 +aI3987 +aI3988 +aI3989 +aI3990 +aI3991 +aI3992 +aI3993 +aI3994 +aI3995 +aI3996 +aI3997 +aI3998 +aI3999 +aI4000 +aI4001 +aI4002 +aI4003 +aI4004 +aI4005 +aI4006 +aI4007 +aI4008 +aI4009 +aI4010 +aI4011 +aI4012 +aI4013 +aI4014 +aI4015 +aI4016 +aI4017 +aI4018 +aI4019 +aI4020 +aI4021 +aI4022 +aI4023 +aI4024 +aI4025 +aI4026 +aI4027 +aI4028 +aI4029 +aI4030 +aI4031 +aI4032 +aI4033 +aI4034 +aI4035 +aI4036 +aI4037 +aI4038 +aI4039 +aI4040 +aI4041 +aI4042 +aI4043 +aI4044 +aI4045 +aI4046 +aI4047 +aI4048 +aI4049 +aI4050 +aI4051 +aI4052 +aI4053 +aI4054 +aI4055 +aI4056 +aI4057 +aI4058 +aI4059 +aI4060 +aI4061 +aI4062 +aI4063 +aI4064 +aI4065 +aI4066 +aI4067 +aI4068 +aI4069 +aI4070 +aI4071 +aI4072 +aI4073 +aI4074 +aI4075 +aI4076 +aI4077 +aI4078 +aI4079 +aI4080 +aI4081 +aI4082 +aI4083 +aI4084 +aI4085 +aI4086 +aI4087 +aI4088 +aI4089 +aI4090 +aI4091 +aI4092 +aI4093 +aI4094 +aI4095 +aI4096 +aI4097 +aI4098 +aI4099 +aI4100 +aI4101 +aI4102 +aI4103 +aI4104 +aI4105 +aI4106 +aI4107 +aI4108 +aI4109 +aI4110 +aI4111 +aI4112 +aI4113 +aI4114 +aI4115 +aI4116 +aI4117 +aI4118 +aI4119 +aI4120 +aI4121 +aI4122 +aI4123 +aI4124 +aI4125 +aI4126 +aI4127 +aI4128 +aI4129 +aI4130 +aI4131 +aI4132 +aI4133 +aI4134 +aI4135 +aI4136 +aI4137 +aI4138 +aI4139 +aI4140 +aI4141 +aI4142 +aI4143 +aI4144 +aI4145 +aI4146 +aI4147 +aI4148 +aI4149 +aI4150 +aI4151 +aI4152 +aI4153 +aI4154 +aI4155 +aI4156 +aI4157 +aI4158 +aI4159 +aI4160 +aI4161 +aI4162 +aI4163 +aI4164 +aI4165 +aI4166 +aI4167 +aI4168 +aI4169 +aI4170 +aI4171 +aI4172 +aI4173 +aI4174 +aI4175 +aI4176 +aI4177 +aI4178 +aI4179 +aI4180 +aI4181 +aI4182 +aI4183 +aI4184 +aI4185 +aI4186 +aI4187 +aI4188 +aI4189 +aI4190 +aI4191 +aI4192 +aI4193 +aI4194 +aI4195 +aI4196 +aI4197 +aI4198 +aI4199 +aI4200 +aI4201 +aI4202 +aI4203 +aI4204 +aI4205 +aI4206 +aI4207 +aI4208 +aI4209 +aI4210 +aI4211 +aI4212 +aI4213 +aI4214 +aI4215 +aI4216 +aI4217 +aI4218 +aI4219 +aI4220 +aI4221 +aI4222 +aI4223 +aI4224 +aI4225 +aI4226 +aI4227 +aI4228 +aI4229 +aI4230 +aI4231 +aI4232 +aI4233 +aI4234 +aI4235 +aI4236 +aI4237 +aI4238 +aI4239 +aI4240 +aI4241 +aI4242 +aI4243 +aI4244 +aI4245 +aI4246 +aI4247 +aI4248 +aI4249 +aI4250 +aI4251 +aI4252 +aI4253 +aI4254 +aI4255 +aI4256 +aI4257 +aI4258 +aI4259 +aI4260 +aI4261 +aI4262 +aI4263 +aI4264 +aI4265 +aI4266 +aI4267 +aI4268 +aI4269 +aI4270 +aI4271 +aI4272 +aI4273 +aI4274 +aI4275 +aI4276 +aI4277 +aI4278 +aI4279 +aI4280 +aI4281 +aI4282 +aI4283 +aI4284 +aI4285 +aI4286 +aI4287 +aI4288 +aI4289 +aI4290 +aI4291 +aI4292 +aI4293 +aI4294 +aI4295 +aI4296 +aI4297 +aI4298 +aI4299 +aI4300 +aI4301 +aI4302 +aI4303 +aI4304 +aI4305 +aI4306 +aI4307 +aI4308 +aI4309 +aI4310 +aI4311 +aI4312 +aI4313 +aI4314 +aI4315 +aI4316 +aI4317 +aI4318 +aI4319 +aI4320 +aI4321 +aI4322 +aI4323 +aI4324 +aI4325 +aI4326 +aI4327 +aI4328 +aI4329 +aI4330 +aI4331 +aI4332 +aI4333 +aI4334 +aI4335 +aI4336 +aI4337 +aI4338 +aI4339 +aI4340 +aI4341 +aI4342 +aI4343 +aI4344 +aI4345 +aI4346 +aI4347 +aI4348 +aI4349 +aI4350 +aI4351 +aI4352 +aI4353 +aI4354 +aI4355 +aI4356 +aI4357 +aI4358 +aI4359 +aI4360 +aI4361 +aI4362 +aI4363 +aI4364 +aI4365 +aI4366 +aI4367 +aI4368 +aI4369 +aI4370 +aI4371 +aI4372 +aI4373 +aI4374 +aI4375 +aI4376 +aI4377 +aI4378 +aI4379 +aI4380 +aI4381 +aI4382 +aI4383 +aI4384 +aI4385 +aI4386 +aI4387 +aI4388 +aI4389 +aI4390 +aI4391 +aI4392 +aI4393 +aI4394 +aI4395 +aI4396 +aI4397 +aI4398 +aI4399 +aI4400 +aI4401 +aI4402 +aI4403 +aI4404 +aI4405 +aI4406 +aI4407 +aI4408 +aI4409 +aI4410 +aI4411 +aI4412 +aI4413 +aI4414 +aI4415 +aI4416 +aI4417 +aI4418 +aI4419 +aI4420 +aI4421 +aI4422 +aI4423 +aI4424 +aI4425 +aI4426 +aI4427 +aI4428 +aI4429 +aI4430 +aI4431 +aI4432 +aI4433 +aI4434 +aI4435 +aI4436 +aI4437 +aI4438 +aI4439 +aI4440 +aI4441 +aI4442 +aI4443 +aI4444 +aI4445 +aI4446 +aI4447 +aI4448 +aI4449 +aI4450 +aI4451 +aI4452 +aI4453 +aI4454 +aI4455 +aI4456 +aI4457 +aI4458 +aI4459 +aI4460 +aI4461 +aI4462 +aI4463 +aI4464 +aI4465 +aI4466 +aI4467 +aI4468 +aI4469 +aI4470 +aI4471 +aI4472 +aI4473 +aI4474 +aI4475 +aI4476 +aI4477 +aI4478 +aI4479 +aI4480 +aI4481 +aI4482 +aI4483 +aI4484 +aI4485 +aI4486 +aI4487 +aI4488 +aI4489 +aI4490 +aI4491 +aI4492 +aI4493 +aI4494 +aI4495 +aI4496 +aI4497 +aI4498 +aI4499 +aI4500 +aI4501 +aI4502 +aI4503 +aI4504 +aI4505 +aI4506 +aI4507 +aI4508 +aI4509 +aI4510 +aI4511 +aI4512 +aI4513 +aI4514 +aI4515 +aI4516 +aI4517 +aI4518 +aI4519 +aI4520 +aI4521 +aI4522 +aI4523 +aI4524 +aI4525 +aI4526 +aI4527 +aI4528 +aI4529 +aI4530 +aI4531 +aI4532 +aI4533 +aI4534 +aI4535 +aI4536 +aI4537 +aI4538 +aI4539 +aI4540 +aI4541 +aI4542 +aI4543 +aI4544 +aI4545 +aI4546 +aI4547 +aI4548 +aI4549 +aI4550 +aI4551 +aI4552 +aI4553 +aI4554 +aI4555 +aI4556 +aI4557 +aI4558 +aI4559 +aI4560 +aI4561 +aI4562 +aI4563 +aI4564 +aI4565 +aI4566 +aI4567 +aI4568 +aI4569 +aI4570 +aI4571 +aI4572 +aI4573 +aI4574 +aI4575 +aI4576 +aI4577 +aI4578 +aI4579 +aI4580 +aI4581 +aI4582 +aI4583 +aI4584 +aI4585 +aI4586 +aI4587 +aI4588 +aI4589 +aI4590 +aI4591 +aI4592 +aI4593 +aI4594 +aI4595 +aI4596 +aI4597 +aI4598 +aI4599 +aI4600 +aI4601 +aI4602 +aI4603 +aI4604 +aI4605 +aI4606 +aI4607 +aI4608 +aI4609 +aI4610 +aI4611 +aI4612 +aI4613 +aI4614 +aI4615 +aI4616 +aI4617 +aI4618 +aI4619 +aI4620 +aI4621 +aI4622 +aI4623 +aI4624 +aI4625 +aI4626 +aI4627 +aI4628 +aI4629 +aI4630 +aI4631 +aI4632 +aI4633 +aI4634 +aI4635 +aI4636 +aI4637 +aI4638 +aI4639 +aI4640 +aI4641 +aI4642 +aI4643 +aI4644 +aI4645 +aI4646 +aI4647 +aI4648 +aI4649 +aI4650 +aI4651 +aI4652 +aI4653 +aI4654 +aI4655 +aI4656 +aI4657 +aI4658 +aI4659 +aI4660 +aI4661 +aI4662 +aI4663 +aI4664 +aI4665 +aI4666 +aI4667 +aI4668 +aI4669 +aI4670 +aI4671 +aI4672 +aI4673 +aI4674 +aI4675 +aI4676 +aI4677 +aI4678 +aI4679 +aI4680 +aI4681 +aI4682 +aI4683 +aI4684 +aI4685 +aI4686 +aI4687 +aI4688 +aI4689 +aI4690 +aI4691 +aI4692 +aI4693 +aI4694 +aI4695 +aI4696 +aI4697 +aI4698 +aI4699 +aI4700 +aI4701 +aI4702 +aI4703 +aI4704 +aI4705 +aI4706 +aI4707 +aI4708 +aI4709 +aI4710 +aI4711 +aI4712 +aI4713 +aI4714 +aI4715 +aI4716 +aI4717 +aI4718 +aI4719 +aI4720 +aI4721 +aI4722 +aI4723 +aI4724 +aI4725 +aI4726 +aI4727 +aI4728 +aI4729 +aI4730 +aI4731 +aI4732 +aI4733 +aI4734 +aI4735 +aI4736 +aI4737 +aI4738 +aI4739 +aI4740 +aI4741 +aI4742 +aI4743 +aI4744 +aI4745 +aI4746 +aI4747 +aI4748 +aI4749 +aI4750 +aI4751 +aI4752 +aI4753 +aI4754 +aI4755 +aI4756 +aI4757 +aI4758 +aI4759 +aI4760 +aI4761 +aI4762 +aI4763 +aI4764 +aI4765 +aI4766 +aI4767 +aI4768 +aI4769 +aI4770 +aI4771 +aI4772 +aI4773 +aI4774 +aI4775 +aI4776 +aI4777 +aI4778 +aI4779 +aI4780 +aI4781 +aI4782 +aI4783 +aI4784 +aI4785 +aI4786 +aI4787 +aI4788 +aI4789 +aI4790 +aI4791 +aI4792 +aI4793 +aI4794 +aI4795 +aI4796 +aI4797 +aI4798 +aI4799 +aI4800 +aI4801 +aI4802 +aI4803 +aI4804 +aI4805 +aI4806 +aI4807 +aI4808 +aI4809 +aI4810 +aI4811 +aI4812 +aI4813 +aI4814 +aI4815 +aI4816 +aI4817 +aI4818 +aI4819 +aI4820 +aI4821 +aI4822 +aI4823 +aI4824 +aI4825 +aI4826 +aI4827 +aI4828 +aI4829 +aI4830 +aI4831 +aI4832 +aI4833 +aI4834 +aI4835 +aI4836 +aI4837 +aI4838 +aI4839 +aI4840 +aI4841 +aI4842 +aI4843 +aI4844 +aI4845 +aI4846 +aI4847 +aI4848 +aI4849 +aI4850 +aI4851 +aI4852 +aI4853 +aI4854 +aI4855 +aI4856 +aI4857 +aI4858 +aI4859 +aI4860 +aI4861 +aI4862 +aI4863 +aI4864 +aI4865 +aI4866 +aI4867 +aI4868 +aI4869 +aI4870 +aI4871 +aI4872 +aI4873 +aI4874 +aI4875 +aI4876 +aI4877 +aI4878 +aI4879 +aI4880 +aI4881 +aI4882 +aI4883 +aI4884 +aI4885 +aI4886 +aI4887 +aI4888 +aI4889 +aI4890 +aI4891 +aI4892 +aI4893 +aI4894 +aI4895 +aI4896 +aI4897 +aI4898 +aI4899 +aI4900 +aI4901 +aI4902 +aI4903 +aI4904 +aI4905 +aI4906 +aI4907 +aI4908 +aI4909 +aI4910 +aI4911 +aI4912 +aI4913 +aI4914 +aI4915 +aI4916 +aI4917 +aI4918 +aI4919 +aI4920 +aI4921 +aI4922 +aI4923 +aI4924 +aI4925 +aI4926 +aI4927 +aI4928 +aI4929 +aI4930 +aI4931 +aI4932 +aI4933 +aI4934 +aI4935 +aI4936 +aI4937 +aI4938 +aI4939 +aI4940 +aI4941 +aI4942 +aI4943 +aI4944 +aI4945 +aI4946 +aI4947 +aI4948 +aI4949 +aI4950 +aI4951 +aI4952 +aI4953 +aI4954 +aI4955 +aI4956 +aI4957 +aI4958 +aI4959 +aI4960 +aI4961 +aI4962 +aI4963 +aI4964 +aI4965 +aI4966 +aI4967 +aI4968 +aI4969 +aI4970 +aI4971 +aI4972 +aI4973 +aI4974 +aI4975 +aI4976 +aI4977 +aI4978 +aI4979 +aI4980 +aI4981 +aI4982 +aI4983 +aI4984 +aI4985 +aI4986 +aI4987 +aI4988 +aI4989 +aI4990 +aI4991 +aI4992 +aI4993 +aI4994 +aI4995 +aI4996 +aI4997 +aI4998 +aI4999 +aI5000 +aI5001 +aI5002 +aI5003 +aI5004 +aI5005 +aI5006 +aI5007 +aI5008 +aI5009 +aI5010 +aI5011 +aI5012 +aI5013 +aI5014 +aI5015 +aI5016 +aI5017 +aI5018 +aI5019 +aI5020 +aI5021 +aI5022 +aI5023 +aI5024 +aI5025 +aI5026 +aI5027 +aI5028 +aI5029 +aI5030 +aI5031 +aI5032 +aI5033 +aI5034 +aI5035 +aI5036 +aI5037 +aI5038 +aI5039 +aI5040 +aI5041 +aI5042 +aI5043 +aI5044 +aI5045 +aI5046 +aI5047 +aI5048 +aI5049 +aI5050 +aI5051 +aI5052 +aI5053 +aI5054 +aI5055 +aI5056 +aI5057 +aI5058 +aI5059 +aI5060 +aI5061 +aI5062 +aI5063 +aI5064 +aI5065 +aI5066 +aI5067 +aI5068 +aI5069 +aI5070 +aI5071 +aI5072 +aI5073 +aI5074 +aI5075 +aI5076 +aI5077 +aI5078 +aI5079 +aI5080 +aI5081 +aI5082 +aI5083 +aI5084 +aI5085 +aI5086 +aI5087 +aI5088 +aI5089 +aI5090 +aI5091 +aI5092 +aI5093 +aI5094 +aI5095 +aI5096 +aI5097 +aI5098 +aI5099 +aI5100 +aI5101 +aI5102 +aI5103 +aI5104 +aI5105 +aI5106 +aI5107 +aI5108 +aI5109 +aI5110 +aI5111 +aI5112 +aI5113 +aI5114 +aI5115 +aI5116 +aI5117 +aI5118 +aI5119 +aI5120 +aI5121 +aI5122 +aI5123 +aI5124 +aI5125 +aI5126 +aI5127 +aI5128 +aI5129 +aI5130 +aI5131 +aI5132 +aI5133 +aI5134 +aI5135 +aI5136 +aI5137 +aI5138 +aI5139 +aI5140 +aI5141 +aI5142 +aI5143 +aI5144 +aI5145 +aI5146 +aI5147 +aI5148 +aI5149 +aI5150 +aI5151 +aI5152 +aI5153 +aI5154 +aI5155 +aI5156 +aI5157 +aI5158 +aI5159 +aI5160 +aI5161 +aI5162 +aI5163 +aI5164 +aI5165 +aI5166 +aI5167 +aI5168 +aI5169 +aI5170 +aI5171 +aI5172 +aI5173 +aI5174 +aI5175 +aI5176 +aI5177 +aI5178 +aI5179 +aI5180 +aI5181 +aI5182 +aI5183 +aI5184 +aI5185 +aI5186 +aI5187 +aI5188 +aI5189 +aI5190 +aI5191 +aI5192 +aI5193 +aI5194 +aI5195 +aI5196 +aI5197 +aI5198 +aI5199 +aI5200 +aI5201 +aI5202 +aI5203 +aI5204 +aI5205 +aI5206 +aI5207 +aI5208 +aI5209 +aI5210 +aI5211 +aI5212 +aI5213 +aI5214 +aI5215 +aI5216 +aI5217 +aI5218 +aI5219 +aI5220 +aI5221 +aI5222 +aI5223 +aI5224 +aI5225 +aI5226 +aI5227 +aI5228 +aI5229 +aI5230 +aI5231 +aI5232 +aI5233 +aI5234 +aI5235 +aI5236 +aI5237 +aI5238 +aI5239 +aI5240 +aI5241 +aI5242 +aI5243 +aI5244 +aI5245 +aI5246 +aI5247 +aI5248 +aI5249 +aI5250 +aI5251 +aI5252 +aI5253 +aI5254 +aI5255 +aI5256 +aI5257 +aI5258 +aI5259 +aI5260 +aI5261 +aI5262 +aI5263 +aI5264 +aI5265 +aI5266 +aI5267 +aI5268 +aI5269 +aI5270 +aI5271 +aI5272 +aI5273 +aI5274 +aI5275 +aI5276 +aI5277 +aI5278 +aI5279 +aI5280 +aI5281 +aI5282 +aI5283 +aI5284 +aI5285 +aI5286 +aI5287 +aI5288 +aI5289 +aI5290 +aI5291 +aI5292 +aI5293 +aI5294 +aI5295 +aI5296 +aI5297 +aI5298 +aI5299 +aI5300 +aI5301 +aI5302 +aI5303 +aI5304 +aI5305 +aI5306 +aI5307 +aI5308 +aI5309 +aI5310 +aI5311 +aI5312 +aI5313 +aI5314 +aI5315 +aI5316 +aI5317 +aI5318 +aI5319 +aI5320 +aI5321 +aI5322 +aI5323 +aI5324 +aI5325 +aI5326 +aI5327 +aI5328 +aI5329 +aI5330 +aI5331 +aI5332 +aI5333 +aI5334 +aI5335 +aI5336 +aI5337 +aI5338 +aI5339 +aI5340 +aI5341 +aI5342 +aI5343 +aI5344 +aI5345 +aI5346 +aI5347 +aI5348 +aI5349 +aI5350 +aI5351 +aI5352 +aI5353 +aI5354 +aI5355 +aI5356 +aI5357 +aI5358 +aI5359 +aI5360 +aI5361 +aI5362 +aI5363 +aI5364 +aI5365 +aI5366 +aI5367 +aI5368 +aI5369 +aI5370 +aI5371 +aI5372 +aI5373 +aI5374 +aI5375 +aI5376 +aI5377 +aI5378 +aI5379 +aI5380 +aI5381 +aI5382 +aI5383 +aI5384 +aI5385 +aI5386 +aI5387 +aI5388 +aI5389 +aI5390 +aI5391 +aI5392 +aI5393 +aI5394 +aI5395 +aI5396 +aI5397 +aI5398 +aI5399 +aI5400 +aI5401 +aI5402 +aI5403 +aI5404 +aI5405 +aI5406 +aI5407 +aI5408 +aI5409 +aI5410 +aI5411 +aI5412 +aI5413 +aI5414 +aI5415 +aI5416 +aI5417 +aI5418 +aI5419 +aI5420 +aI5421 +aI5422 +aI5423 +aI5424 +aI5425 +aI5426 +aI5427 +aI5428 +aI5429 +aI5430 +aI5431 +aI5432 +aI5433 +aI5434 +aI5435 +aI5436 +aI5437 +aI5438 +aI5439 +aI5440 +aI5441 +aI5442 +aI5443 +aI5444 +aI5445 +aI5446 +aI5447 +aI5448 +aI5449 +aI5450 +aI5451 +aI5452 +aI5453 +aI5454 +aI5455 +aI5456 +aI5457 +aI5458 +aI5459 +aI5460 +aI5461 +aI5462 +aI5463 +aI5464 +aI5465 +aI5466 +aI5467 +aI5468 +aI5469 +aI5470 +aI5471 +aI5472 +aI5473 +aI5474 +aI5475 +aI5476 +aI5477 +aI5478 +aI5479 +aI5480 +aI5481 +aI5482 +aI5483 +aI5484 +aI5485 +aI5486 +aI5487 +aI5488 +aI5489 +aI5490 +aI5491 +aI5492 +aI5493 +aI5494 +aI5495 +aI5496 +aI5497 +aI5498 +aI5499 +aI5500 +aI5501 +aI5502 +aI5503 +aI5504 +aI5505 +aI5506 +aI5507 +aI5508 +aI5509 +aI5510 +aI5511 +aI5512 +aI5513 +aI5514 +aI5515 +aI5516 +aI5517 +aI5518 +aI5519 +aI5520 +aI5521 +aI5522 +aI5523 +aI5524 +aI5525 +aI5526 +aI5527 +aI5528 +aI5529 +aI5530 +aI5531 +aI5532 +aI5533 +aI5534 +aI5535 +aI5536 +aI5537 +aI5538 +aI5539 +aI5540 +aI5541 +aI5542 +aI5543 +aI5544 +aI5545 +aI5546 +aI5547 +aI5548 +aI5549 +aI5550 +aI5551 +aI5552 +aI5553 +aI5554 +aI5555 +aI5556 +aI5557 +aI5558 +aI5559 +aI5560 +aI5561 +aI5562 +aI5563 +aI5564 +aI5565 +aI5566 +aI5567 +aI5568 +aI5569 +aI5570 +aI5571 +aI5572 +aI5573 +aI5574 +aI5575 +aI5576 +aI5577 +aI5578 +aI5579 +aI5580 +aI5581 +aI5582 +aI5583 +aI5584 +aI5585 +aI5586 +aI5587 +aI5588 +aI5589 +aI5590 +aI5591 +aI5592 +aI5593 +aI5594 +aI5595 +aI5596 +aI5597 +aI5598 +aI5599 +aI5600 +aI5601 +aI5602 +aI5603 +aI5604 +aI5605 +aI5606 +aI5607 +aI5608 +aI5609 +aI5610 +aI5611 +aI5612 +aI5613 +aI5614 +aI5615 +aI5616 +aI5617 +aI5618 +aI5619 +aI5620 +aI5621 +aI5622 +aI5623 +aI5624 +aI5625 +aI5626 +aI5627 +aI5628 +aI5629 +aI5630 +aI5631 +aI5632 +aI5633 +aI5634 +aI5635 +aI5636 +aI5637 +aI5638 +aI5639 +aI5640 +aI5641 +aI5642 +aI5643 +aI5644 +aI5645 +aI5646 +aI5647 +aI5648 +aI5649 +aI5650 +aI5651 +aI5652 +aI5653 +aI5654 +aI5655 +aI5656 +aI5657 +aI5658 +aI5659 +aI5660 +aI5661 +aI5662 +aI5663 +aI5664 +aI5665 +aI5666 +aI5667 +aI5668 +aI5669 +aI5670 +aI5671 +aI5672 +aI5673 +aI5674 +aI5675 +aI5676 +aI5677 +aI5678 +aI5679 +aI5680 +aI5681 +aI5682 +aI5683 +aI5684 +aI5685 +aI5686 +aI5687 +aI5688 +aI5689 +aI5690 +aI5691 +aI5692 +aI5693 +aI5694 +aI5695 +aI5696 +aI5697 +aI5698 +aI5699 +aI5700 +aI5701 +aI5702 +aI5703 +aI5704 +aI5705 +aI5706 +aI5707 +aI5708 +aI5709 +aI5710 +aI5711 +aI5712 +aI5713 +aI5714 +aI5715 +aI5716 +aI5717 +aI5718 +aI5719 +aI5720 +aI5721 +aI5722 +aI5723 +aI5724 +aI5725 +aI5726 +aI5727 +aI5728 +aI5729 +aI5730 +aI5731 +aI5732 +aI5733 +aI5734 +aI5735 +aI5736 +aI5737 +aI5738 +aI5739 +aI5740 +aI5741 +aI5742 +aI5743 +aI5744 +aI5745 +aI5746 +aI5747 +aI5748 +aI5749 +aI5750 +aI5751 +aI5752 +aI5753 +aI5754 +aI5755 +aI5756 +aI5757 +aI5758 +aI5759 +aI5760 +aI5761 +aI5762 +aI5763 +aI5764 +aI5765 +aI5766 +aI5767 +aI5768 +aI5769 +aI5770 +aI5771 +aI5772 +aI5773 +aI5774 +aI5775 +aI5776 +aI5777 +aI5778 +aI5779 +aI5780 +aI5781 +aI5782 +aI5783 +aI5784 +aI5785 +aI5786 +aI5787 +aI5788 +aI5789 +aI5790 +aI5791 +aI5792 +aI5793 +aI5794 +aI5795 +aI5796 +aI5797 +aI5798 +aI5799 +aI5800 +aI5801 +aI5802 +aI5803 +aI5804 +aI5805 +aI5806 +aI5807 +aI5808 +aI5809 +aI5810 +aI5811 +aI5812 +aI5813 +aI5814 +aI5815 +aI5816 +aI5817 +aI5818 +aI5819 +aI5820 +aI5821 +aI5822 +aI5823 +aI5824 +aI5825 +aI5826 +aI5827 +aI5828 +aI5829 +aI5830 +aI5831 +aI5832 +aI5833 +aI5834 +aI5835 +aI5836 +aI5837 +aI5838 +aI5839 +aI5840 +aI5841 +aI5842 +aI5843 +aI5844 +aI5845 +aI5846 +aI5847 +aI5848 +aI5849 +aI5850 +aI5851 +aI5852 +aI5853 +aI5854 +aI5855 +aI5856 +aI5857 +aI5858 +aI5859 +aI5860 +aI5861 +aI5862 +aI5863 +aI5864 +aI5865 +aI5866 +aI5867 +aI5868 +aI5869 +aI5870 +aI5871 +aI5872 +aI5873 +aI5874 +aI5875 +aI5876 +aI5877 +aI5878 +aI5879 +aI5880 +aI5881 +aI5882 +aI5883 +aI5884 +aI5885 +aI5886 +aI5887 +aI5888 +aI5889 +aI5890 +aI5891 +aI5892 +aI5893 +aI5894 +aI5895 +aI5896 +aI5897 +aI5898 +aI5899 +aI5900 +aI5901 +aI5902 +aI5903 +aI5904 +aI5905 +aI5906 +aI5907 +aI5908 +aI5909 +aI5910 +aI5911 +aI5912 +aI5913 +aI5914 +aI5915 +aI5916 +aI5917 +aI5918 +aI5919 +aI5920 +aI5921 +aI5922 +aI5923 +aI5924 +aI5925 +aI5926 +aI5927 +aI5928 +aI5929 +aI5930 +aI5931 +aI5932 +aI5933 +aI5934 +aI5935 +aI5936 +aI5937 +aI5938 +aI5939 +aI5940 +aI5941 +aI5942 +aI5943 +aI5944 +aI5945 +aI5946 +aI5947 +aI5948 +aI5949 +aI5950 +aI5951 +aI5952 +aI5953 +aI5954 +aI5955 +aI5956 +aI5957 +aI5958 +aI5959 +aI5960 +aI5961 +aI5962 +aI5963 +aI5964 +aI5965 +aI5966 +aI5967 +aI5968 +aI5969 +aI5970 +aI5971 +aI5972 +aI5973 +aI5974 +aI5975 +aI5976 +aI5977 +aI5978 +aI5979 +aI5980 +aI5981 +aI5982 +aI5983 +aI5984 +aI5985 +aI5986 +aI5987 +aI5988 +aI5989 +aI5990 +aI5991 +aI5992 +aI5993 +aI5994 +aI5995 +aI5996 +aI5997 +aI5998 +aI5999 +aI6000 +aI6001 +aI6002 +aI6003 +aI6004 +aI6005 +aI6006 +aI6007 +aI6008 +aI6009 +aI6010 +aI6011 +aI6012 +aI6013 +aI6014 +aI6015 +aI6016 +aI6017 +aI6018 +aI6019 +aI6020 +aI6021 +aI6022 +aI6023 +aI6024 +aI6025 +aI6026 +aI6027 +aI6028 +aI6029 +aI6030 +aI6031 +aI6032 +aI6033 +aI6034 +aI6035 +aI6036 +aI6037 +aI6038 +aI6039 +aI6040 +aI6041 +aI6042 +aI6043 +aI6044 +aI6045 +aI6046 +aI6047 +aI6048 +aI6049 +aI6050 +aI6051 +aI6052 +aI6053 +aI6054 +aI6055 +aI6056 +aI6057 +aI6058 +aI6059 +aI6060 +aI6061 +aI6062 +aI6063 +aI6064 +aI6065 +aI6066 +aI6067 +aI6068 +aI6069 +aI6070 +aI6071 +aI6072 +aI6073 +aI6074 +aI6075 +aI6076 +aI6077 +aI6078 +aI6079 +aI6080 +aI6081 +aI6082 +aI6083 +aI6084 +aI6085 +aI6086 +aI6087 +aI6088 +aI6089 +aI6090 +aI6091 +aI6092 +aI6093 +aI6094 +aI6095 +aI6096 +aI6097 +aI6098 +aI6099 +aI6100 +aI6101 +aI6102 +aI6103 +aI6104 +aI6105 +aI6106 +aI6107 +aI6108 +aI6109 +aI6110 +aI6111 +aI6112 +aI6113 +aI6114 +aI6115 +aI6116 +aI6117 +aI6118 +aI6119 +aI6120 +aI6121 +aI6122 +aI6123 +aI6124 +aI6125 +aI6126 +aI6127 +aI6128 +aI6129 +aI6130 +aI6131 +aI6132 +aI6133 +aI6134 +aI6135 +aI6136 +aI6137 +aI6138 +aI6139 +aI6140 +aI6141 +aI6142 +aI6143 +aI6144 +aI6145 +aI6146 +aI6147 +aI6148 +aI6149 +aI6150 +aI6151 +aI6152 +aI6153 +aI6154 +aI6155 +aI6156 +aI6157 +aI6158 +aI6159 +aI6160 +aI6161 +aI6162 +aI6163 +aI6164 +aI6165 +aI6166 +aI6167 +aI6168 +aI6169 +aI6170 +aI6171 +aI6172 +aI6173 +aI6174 +aI6175 +aI6176 +aI6177 +aI6178 +aI6179 +aI6180 +aI6181 +aI6182 +aI6183 +aI6184 +aI6185 +aI6186 +aI6187 +aI6188 +aI6189 +aI6190 +aI6191 +aI6192 +aI6193 +aI6194 +aI6195 +aI6196 +aI6197 +aI6198 +aI6199 +aI6200 +aI6201 +aI6202 +aI6203 +aI6204 +aI6205 +aI6206 +aI6207 +aI6208 +aI6209 +aI6210 +aI6211 +aI6212 +aI6213 +aI6214 +aI6215 +aI6216 +aI6217 +aI6218 +aI6219 +aI6220 +aI6221 +aI6222 +aI6223 +aI6224 +aI6225 +aI6226 +aI6227 +aI6228 +aI6229 +aI6230 +aI6231 +aI6232 +aI6233 +aI6234 +aI6235 +aI6236 +aI6237 +aI6238 +aI6239 +aI6240 +aI6241 +aI6242 +aI6243 +aI6244 +aI6245 +aI6246 +aI6247 +aI6248 +aI6249 +aI6250 +aI6251 +aI6252 +aI6253 +aI6254 +aI6255 +aI6256 +aI6257 +aI6258 +aI6259 +aI6260 +aI6261 +aI6262 +aI6263 +aI6264 +aI6265 +aI6266 +aI6267 +aI6268 +aI6269 +aI6270 +aI6271 +aI6272 +aI6273 +aI6274 +aI6275 +aI6276 +aI6277 +aI6278 +aI6279 +aI6280 +aI6281 +aI6282 +aI6283 +aI6284 +aI6285 +aI6286 +aI6287 +aI6288 +aI6289 +aI6290 +aI6291 +aI6292 +aI6293 +aI6294 +aI6295 +aI6296 +aI6297 +aI6298 +aI6299 +aI6300 +aI6301 +aI6302 +aI6303 +aI6304 +aI6305 +aI6306 +aI6307 +aI6308 +aI6309 +aI6310 +aI6311 +aI6312 +aI6313 +aI6314 +aI6315 +aI6316 +aI6317 +aI6318 +aI6319 +aI6320 +aI6321 +aI6322 +aI6323 +aI6324 +aI6325 +aI6326 +aI6327 +aI6328 +aI6329 +aI6330 +aI6331 +aI6332 +aI6333 +aI6334 +aI6335 +aI6336 +aI6337 +aI6338 +aI6339 +aI6340 +aI6341 +aI6342 +aI6343 +aI6344 +aI6345 +aI6346 +aI6347 +aI6348 +aI6349 +aI6350 +aI6351 +aI6352 +aI6353 +aI6354 +aI6355 +aI6356 +aI6357 +aI6358 +aI6359 +aI6360 +aI6361 +aI6362 +aI6363 +aI6364 +aI6365 +aI6366 +aI6367 +aI6368 +aI6369 +aI6370 +aI6371 +aI6372 +aI6373 +aI6374 +aI6375 +aI6376 +aI6377 +aI6378 +aI6379 +aI6380 +aI6381 +aI6382 +aI6383 +aI6384 +aI6385 +aI6386 +aI6387 +aI6388 +aI6389 +aI6390 +aI6391 +aI6392 +aI6393 +aI6394 +aI6395 +aI6396 +aI6397 +aI6398 +aI6399 +aI6400 +aI6401 +aI6402 +aI6403 +aI6404 +aI6405 +aI6406 +aI6407 +aI6408 +aI6409 +aI6410 +aI6411 +aI6412 +aI6413 +aI6414 +aI6415 +aI6416 +aI6417 +aI6418 +aI6419 +aI6420 +aI6421 +aI6422 +aI6423 +aI6424 +aI6425 +aI6426 +aI6427 +aI6428 +aI6429 +aI6430 +aI6431 +aI6432 +aI6433 +aI6434 +aI6435 +aI6436 +aI6437 +aI6438 +aI6439 +aI6440 +aI6441 +aI6442 +aI6443 +aI6444 +aI6445 +aI6446 +aI6447 +aI6448 +aI6449 +aI6450 +aI6451 +aI6452 +aI6453 +aI6454 +aI6455 +aI6456 +aI6457 +aI6458 +aI6459 +aI6460 +aI6461 +aI6462 +aI6463 +aI6464 +aI6465 +aI6466 +aI6467 +aI6468 +aI6469 +aI6470 +aI6471 +aI6472 +aI6473 +aI6474 +aI6475 +aI6476 +aI6477 +aI6478 +aI6479 +aI6480 +aI6481 +aI6482 +aI6483 +aI6484 +aI6485 +aI6486 +aI6487 +aI6488 +aI6489 +aI6490 +aI6491 +aI6492 +aI6493 +aI6494 +aI6495 +aI6496 +aI6497 +aI6498 +aI6499 +aI6500 +aI6501 +aI6502 +aI6503 +aI6504 +aI6505 +aI6506 +aI6507 +aI6508 +aI6509 +aI6510 +aI6511 +aI6512 +aI6513 +aI6514 +aI6515 +aI6516 +aI6517 +aI6518 +aI6519 +aI6520 +aI6521 +aI6522 +aI6523 +aI6524 +aI6525 +aI6526 +aI6527 +aI6528 +aI6529 +aI6530 +aI6531 +aI6532 +aI6533 +aI6534 +aI6535 +aI6536 +aI6537 +aI6538 +aI6539 +aI6540 +aI6541 +aI6542 +aI6543 +aI6544 +aI6545 +aI6546 +aI6547 +aI6548 +aI6549 +aI6550 +aI6551 +aI6552 +aI6553 +aI6554 +aI6555 +aI6556 +aI6557 +aI6558 +aI6559 +aI6560 +aI6561 +aI6562 +aI6563 +aI6564 +aI6565 +aI6566 +aI6567 +aI6568 +aI6569 +aI6570 +aI6571 +aI6572 +aI6573 +aI6574 +aI6575 +aI6576 +aI6577 +aI6578 +aI6579 +aI6580 +aI6581 +aI6582 +aI6583 +aI6584 +aI6585 +aI6586 +aI6587 +aI6588 +aI6589 +aI6590 +aI6591 +aI6592 +aI6593 +aI6594 +aI6595 +aI6596 +aI6597 +aI6598 +aI6599 +aI6600 +aI6601 +aI6602 +aI6603 +aI6604 +aI6605 +aI6606 +aI6607 +aI6608 +aI6609 +aI6610 +aI6611 +aI6612 +aI6613 +aI6614 +aI6615 +aI6616 +aI6617 +aI6618 +aI6619 +aI6620 +aI6621 +aI6622 +aI6623 +aI6624 +aI6625 +aI6626 +aI6627 +aI6628 +aI6629 +aI6630 +aI6631 +aI6632 +aI6633 +aI6634 +aI6635 +aI6636 +aI6637 +aI6638 +aI6639 +aI6640 +aI6641 +aI6642 +aI6643 +aI6644 +aI6645 +aI6646 +aI6647 +aI6648 +aI6649 +aI6650 +aI6651 +aI6652 +aI6653 +aI6654 +aI6655 +aI6656 +aI6657 +aI6658 +aI6659 +aI6660 +aI6661 +aI6662 +aI6663 +aI6664 +aI6665 +aI6666 +aI6667 +aI6668 +aI6669 +aI6670 +aI6671 +aI6672 +aI6673 +aI6674 +aI6675 +aI6676 +aI6677 +aI6678 +aI6679 +aI6680 +aI6681 +aI6682 +aI6683 +aI6684 +aI6685 +aI6686 +aI6687 +aI6688 +aI6689 +aI6690 +aI6691 +aI6692 +aI6693 +aI6694 +aI6695 +aI6696 +aI6697 +aI6698 +aI6699 +aI6700 +aI6701 +aI6702 +aI6703 +aI6704 +aI6705 +aI6706 +aI6707 +aI6708 +aI6709 +aI6710 +aI6711 +aI6712 +aI6713 +aI6714 +aI6715 +aI6716 +aI6717 +aI6718 +aI6719 +aI6720 +aI6721 +aI6722 +aI6723 +aI6724 +aI6725 +aI6726 +aI6727 +aI6728 +aI6729 +aI6730 +aI6731 +aI6732 +aI6733 +aI6734 +aI6735 +aI6736 +aI6737 +aI6738 +aI6739 +aI6740 +aI6741 +aI6742 +aI6743 +aI6744 +aI6745 +aI6746 +aI6747 +aI6748 +aI6749 +aI6750 +aI6751 +aI6752 +aI6753 +aI6754 +aI6755 +aI6756 +aI6757 +aI6758 +aI6759 +aI6760 +aI6761 +aI6762 +aI6763 +aI6764 +aI6765 +aI6766 +aI6767 +aI6768 +aI6769 +aI6770 +aI6771 +aI6772 +aI6773 +aI6774 +aI6775 +aI6776 +aI6777 +aI6778 +aI6779 +aI6780 +aI6781 +aI6782 +aI6783 +aI6784 +aI6785 +aI6786 +aI6787 +aI6788 +aI6789 +aI6790 +aI6791 +aI6792 +aI6793 +aI6794 +aI6795 +aI6796 +aI6797 +aI6798 +aI6799 +aI6800 +aI6801 +aI6802 +aI6803 +aI6804 +aI6805 +aI6806 +aI6807 +aI6808 +aI6809 +aI6810 +aI6811 +aI6812 +aI6813 +aI6814 +aI6815 +aI6816 +aI6817 +aI6818 +aI6819 +aI6820 +aI6821 +aI6822 +aI6823 +aI6824 +aI6825 +aI6826 +aI6827 +aI6828 +aI6829 +aI6830 +aI6831 +aI6832 +aI6833 +aI6834 +aI6835 +aI6836 +aI6837 +aI6838 +aI6839 +aI6840 +aI6841 +aI6842 +aI6843 +aI6844 +aI6845 +aI6846 +aI6847 +aI6848 +aI6849 +aI6850 +aI6851 +aI6852 +aI6853 +aI6854 +aI6855 +aI6856 +aI6857 +aI6858 +aI6859 +aI6860 +aI6861 +aI6862 +aI6863 +aI6864 +aI6865 +aI6866 +aI6867 +aI6868 +aI6869 +aI6870 +aI6871 +aI6872 +aI6873 +aI6874 +aI6875 +aI6876 +aI6877 +aI6878 +aI6879 +aI6880 +aI6881 +aI6882 +aI6883 +aI6884 +aI6885 +aI6886 +aI6887 +aI6888 +aI6889 +aI6890 +aI6891 +aI6892 +aI6893 +aI6894 +aI6895 +aI6896 +aI6897 +aI6898 +aI6899 +aI6900 +aI6901 +aI6902 +aI6903 +aI6904 +aI6905 +aI6906 +aI6907 +aI6908 +aI6909 +aI6910 +aI6911 +aI6912 +aI6913 +aI6914 +aI6915 +aI6916 +aI6917 +aI6918 +aI6919 +aI6920 +aI6921 +aI6922 +aI6923 +aI6924 +aI6925 +aI6926 +aI6927 +aI6928 +aI6929 +aI6930 +aI6931 +aI6932 +aI6933 +aI6934 +aI6935 +aI6936 +aI6937 +aI6938 +aI6939 +aI6940 +aI6941 +aI6942 +aI6943 +aI6944 +aI6945 +aI6946 +aI6947 +aI6948 +aI6949 +aI6950 +aI6951 +aI6952 +aI6953 +aI6954 +aI6955 +aI6956 +aI6957 +aI6958 +aI6959 +aI6960 +aI6961 +aI6962 +aI6963 +aI6964 +aI6965 +aI6966 +aI6967 +aI6968 +aI6969 +aI6970 +aI6971 +aI6972 +aI6973 +aI6974 +aI6975 +aI6976 +aI6977 +aI6978 +aI6979 +aI6980 +aI6981 +aI6982 +aI6983 +aI6984 +aI6985 +aI6986 +aI6987 +aI6988 +aI6989 +aI6990 +aI6991 +aI6992 +aI6993 +aI6994 +aI6995 +aI6996 +aI6997 +aI6998 +aI6999 +aI7000 +aI7001 +aI7002 +aI7003 +aI7004 +aI7005 +aI7006 +aI7007 +aI7008 +aI7009 +aI7010 +aI7011 +aI7012 +aI7013 +aI7014 +aI7015 +aI7016 +aI7017 +aI7018 +aI7019 +aI7020 +aI7021 +aI7022 +aI7023 +aI7024 +aI7025 +aI7026 +aI7027 +aI7028 +aI7029 +aI7030 +aI7031 +aI7032 +aI7033 +aI7034 +aI7035 +aI7036 +aI7037 +aI7038 +aI7039 +aI7040 +aI7041 +aI7042 +aI7043 +aI7044 +aI7045 +aI7046 +aI7047 +aI7048 +aI7049 +aI7050 +aI7051 +aI7052 +aI7053 +aI7054 +aI7055 +aI7056 +aI7057 +aI7058 +aI7059 +aI7060 +aI7061 +aI7062 +aI7063 +aI7064 +aI7065 +aI7066 +aI7067 +aI7068 +aI7069 +aI7070 +aI7071 +aI7072 +aI7073 +aI7074 +aI7075 +aI7076 +aI7077 +aI7078 +aI7079 +aI7080 +aI7081 +aI7082 +aI7083 +aI7084 +aI7085 +aI7086 +aI7087 +aI7088 +aI7089 +aI7090 +aI7091 +aI7092 +aI7093 +aI7094 +aI7095 +aI7096 +aI7097 +aI7098 +aI7099 +aI7100 +aI7101 +aI7102 +aI7103 +aI7104 +aI7105 +aI7106 +aI7107 +aI7108 +aI7109 +aI7110 +aI7111 +aI7112 +aI7113 +aI7114 +aI7115 +aI7116 +aI7117 +aI7118 +aI7119 +aI7120 +aI7121 +aI7122 +aI7123 +aI7124 +aI7125 +aI7126 +aI7127 +aI7128 +aI7129 +aI7130 +aI7131 +aI7132 +aI7133 +aI7134 +aI7135 +aI7136 +aI7137 +aI7138 +aI7139 +aI7140 +aI7141 +aI7142 +aI7143 +aI7144 +aI7145 +aI7146 +aI7147 +aI7148 +aI7149 +aI7150 +aI7151 +aI7152 +aI7153 +aI7154 +aI7155 +aI7156 +aI7157 +aI7158 +aI7159 +aI7160 +aI7161 +aI7162 +aI7163 +aI7164 +aI7165 +aI7166 +aI7167 +aI7168 +aI7169 +aI7170 +aI7171 +aI7172 +aI7173 +aI7174 +aI7175 +aI7176 +aI7177 +aI7178 +aI7179 +aI7180 +aI7181 +aI7182 +aI7183 +aI7184 +aI7185 +aI7186 +aI7187 +aI7188 +aI7189 +aI7190 +aI7191 +aI7192 +aI7193 +aI7194 +aI7195 +aI7196 +aI7197 +aI7198 +aI7199 +aI7200 +aI7201 +aI7202 +aI7203 +aI7204 +aI7205 +aI7206 +aI7207 +aI7208 +aI7209 +aI7210 +aI7211 +aI7212 +aI7213 +aI7214 +aI7215 +aI7216 +aI7217 +aI7218 +aI7219 +aI7220 +aI7221 +aI7222 +aI7223 +aI7224 +aI7225 +aI7226 +aI7227 +aI7228 +aI7229 +aI7230 +aI7231 +aI7232 +aI7233 +aI7234 +aI7235 +aI7236 +aI7237 +aI7238 +aI7239 +aI7240 +aI7241 +aI7242 +aI7243 +aI7244 +aI7245 +aI7246 +aI7247 +aI7248 +aI7249 +aI7250 +aI7251 +aI7252 +aI7253 +aI7254 +aI7255 +aI7256 +aI7257 +aI7258 +aI7259 +aI7260 +aI7261 +aI7262 +aI7263 +aI7264 +aI7265 +aI7266 +aI7267 +aI7268 +aI7269 +aI7270 +aI7271 +aI7272 +aI7273 +aI7274 +aI7275 +aI7276 +aI7277 +aI7278 +aI7279 +aI7280 +aI7281 +aI7282 +aI7283 +aI7284 +aI7285 +aI7286 +aI7287 +aI7288 +aI7289 +aI7290 +aI7291 +aI7292 +aI7293 +aI7294 +aI7295 +aI7296 +aI7297 +aI7298 +aI7299 +aI7300 +aI7301 +aI7302 +aI7303 +aI7304 +aI7305 +aI7306 +aI7307 +aI7308 +aI7309 +aI7310 +aI7311 +aI7312 +aI7313 +aI7314 +aI7315 +aI7316 +aI7317 +aI7318 +aI7319 +aI7320 +aI7321 +aI7322 +aI7323 +aI7324 +aI7325 +aI7326 +aI7327 +aI7328 +aI7329 +aI7330 +aI7331 +aI7332 +aI7333 +aI7334 +aI7335 +aI7336 +aI7337 +aI7338 +aI7339 +aI7340 +aI7341 +aI7342 +aI7343 +aI7344 +aI7345 +aI7346 +aI7347 +aI7348 +aI7349 +aI7350 +aI7351 +aI7352 +aI7353 +aI7354 +aI7355 +aI7356 +aI7357 +aI7358 +aI7359 +aI7360 +aI7361 +aI7362 +aI7363 +aI7364 +aI7365 +aI7366 +aI7367 +aI7368 +aI7369 +aI7370 +aI7371 +aI7372 +aI7373 +aI7374 +aI7375 +aI7376 +aI7377 +aI7378 +aI7379 +aI7380 +aI7381 +aI7382 +aI7383 +aI7384 +aI7385 +aI7386 +aI7387 +aI7388 +aI7389 +aI7390 +aI7391 +aI7392 +aI7393 +aI7394 +aI7395 +aI7396 +aI7397 +aI7398 +aI7399 +aI7400 +aI7401 +aI7402 +aI7403 +aI7404 +aI7405 +aI7406 +aI7407 +aI7408 +aI7409 +aI7410 +aI7411 +aI7412 +aI7413 +aI7414 +aI7415 +aI7416 +aI7417 +aI7418 +aI7419 +aI7420 +aI7421 +aI7422 +aI7423 +aI7424 +aI7425 +aI7426 +aI7427 +aI7428 +aI7429 +aI7430 +aI7431 +aI7432 +aI7433 +aI7434 +aI7435 +aI7436 +aI7437 +aI7438 +aI7439 +aI7440 +aI7441 +aI7442 +aI7443 +aI7444 +aI7445 +aI7446 +aI7447 +aI7448 +aI7449 +aI7450 +aI7451 +aI7452 +aI7453 +aI7454 +aI7455 +aI7456 +aI7457 +aI7458 +aI7459 +aI7460 +aI7461 +aI7462 +aI7463 +aI7464 +aI7465 +aI7466 +aI7467 +aI7468 +aI7469 +aI7470 +aI7471 +aI7472 +aI7473 +aI7474 +aI7475 +aI7476 +aI7477 +aI7478 +aI7479 +aI7480 +aI7481 +aI7482 +aI7483 +aI7484 +aI7485 +aI7486 +aI7487 +aI7488 +aI7489 +aI7490 +aI7491 +aI7492 +aI7493 +aI7494 +aI7495 +aI7496 +aI7497 +aI7498 +aI7499 +aI7500 +aI7501 +aI7502 +aI7503 +aI7504 +aI7505 +aI7506 +aI7507 +aI7508 +aI7509 +aI7510 +aI7511 +aI7512 +aI7513 +aI7514 +aI7515 +aI7516 +aI7517 +aI7518 +aI7519 +aI7520 +aI7521 +aI7522 +aI7523 +aI7524 +aI7525 +aI7526 +aI7527 +aI7528 +aI7529 +aI7530 +aI7531 +aI7532 +aI7533 +aI7534 +aI7535 +aI7536 +aI7537 +aI7538 +aI7539 +aI7540 +aI7541 +aI7542 +aI7543 +aI7544 +aI7545 +aI7546 +aI7547 +aI7548 +aI7549 +aI7550 +aI7551 +aI7552 +aI7553 +aI7554 +aI7555 +aI7556 +aI7557 +aI7558 +aI7559 +aI7560 +aI7561 +aI7562 +aI7563 +aI7564 +aI7565 +aI7566 +aI7567 +aI7568 +aI7569 +aI7570 +aI7571 +aI7572 +aI7573 +aI7574 +aI7575 +aI7576 +aI7577 +aI7578 +aI7579 +aI7580 +aI7581 +aI7582 +aI7583 +aI7584 +aI7585 +aI7586 +aI7587 +aI7588 +aI7589 +aI7590 +aI7591 +aI7592 +aI7593 +aI7594 +aI7595 +aI7596 +aI7597 +aI7598 +aI7599 +aI7600 +aI7601 +aI7602 +aI7603 +aI7604 +aI7605 +aI7606 +aI7607 +aI7608 +aI7609 +aI7610 +aI7611 +aI7612 +aI7613 +aI7614 +aI7615 +aI7616 +aI7617 +aI7618 +aI7619 +aI7620 +aI7621 +aI7622 +aI7623 +aI7624 +aI7625 +aI7626 +aI7627 +aI7628 +aI7629 +aI7630 +aI7631 +aI7632 +aI7633 +aI7634 +aI7635 +aI7636 +aI7637 +aI7638 +aI7639 +aI7640 +aI7641 +aI7642 +aI7643 +aI7644 +aI7645 +aI7646 +aI7647 +aI7648 +aI7649 +aI7650 +aI7651 +aI7652 +aI7653 +aI7654 +aI7655 +aI7656 +aI7657 +aI7658 +aI7659 +aI7660 +aI7661 +aI7662 +aI7663 +aI7664 +aI7665 +aI7666 +aI7667 +aI7668 +aI7669 +aI7670 +aI7671 +aI7672 +aI7673 +aI7674 +aI7675 +aI7676 +aI7677 +aI7678 +aI7679 +aI7680 +aI7681 +aI7682 +aI7683 +aI7684 +aI7685 +aI7686 +aI7687 +aI7688 +aI7689 +aI7690 +aI7691 +aI7692 +aI7693 +aI7694 +aI7695 +aI7696 +aI7697 +aI7698 +aI7699 +aI7700 +aI7701 +aI7702 +aI7703 +aI7704 +aI7705 +aI7706 +aI7707 +aI7708 +aI7709 +aI7710 +aI7711 +aI7712 +aI7713 +aI7714 +aI7715 +aI7716 +aI7717 +aI7718 +aI7719 +aI7720 +aI7721 +aI7722 +aI7723 +aI7724 +aI7725 +aI7726 +aI7727 +aI7728 +aI7729 +aI7730 +aI7731 +aI7732 +aI7733 +aI7734 +aI7735 +aI7736 +aI7737 +aI7738 +aI7739 +aI7740 +aI7741 +aI7742 +aI7743 +aI7744 +aI7745 +aI7746 +aI7747 +aI7748 +aI7749 +aI7750 +aI7751 +aI7752 +aI7753 +aI7754 +aI7755 +aI7756 +aI7757 +aI7758 +aI7759 +aI7760 +aI7761 +aI7762 +aI7763 +aI7764 +aI7765 +aI7766 +aI7767 +aI7768 +aI7769 +aI7770 +aI7771 +aI7772 +aI7773 +aI7774 +aI7775 +aI7776 +aI7777 +aI7778 +aI7779 +aI7780 +aI7781 +aI7782 +aI7783 +aI7784 +aI7785 +aI7786 +aI7787 +aI7788 +aI7789 +aI7790 +aI7791 +aI7792 +aI7793 +aI7794 +aI7795 +aI7796 +aI7797 +aI7798 +aI7799 +aI7800 +aI7801 +aI7802 +aI7803 +aI7804 +aI7805 +aI7806 +aI7807 +aI7808 +aI7809 +aI7810 +aI7811 +aI7812 +aI7813 +aI7814 +aI7815 +aI7816 +aI7817 +aI7818 +aI7819 +aI7820 +aI7821 +aI7822 +aI7823 +aI7824 +aI7825 +aI7826 +aI7827 +aI7828 +aI7829 +aI7830 +aI7831 +aI7832 +aI7833 +aI7834 +aI7835 +aI7836 +aI7837 +aI7838 +aI7839 +aI7840 +aI7841 +aI7842 +aI7843 +aI7844 +aI7845 +aI7846 +aI7847 +aI7848 +aI7849 +aI7850 +aI7851 +aI7852 +aI7853 +aI7854 +aI7855 +aI7856 +aI7857 +aI7858 +aI7859 +aI7860 +aI7861 +aI7862 +aI7863 +aI7864 +aI7865 +aI7866 +aI7867 +aI7868 +aI7869 +aI7870 +aI7871 +aI7872 +aI7873 +aI7874 +aI7875 +aI7876 +aI7877 +aI7878 +aI7879 +aI7880 +aI7881 +aI7882 +aI7883 +aI7884 +aI7885 +aI7886 +aI7887 +aI7888 +aI7889 +aI7890 +aI7891 +aI7892 +aI7893 +aI7894 +aI7895 +aI7896 +aI7897 +aI7898 +aI7899 +aI7900 +aI7901 +aI7902 +aI7903 +aI7904 +aI7905 +aI7906 +aI7907 +aI7908 +aI7909 +aI7910 +aI7911 +aI7912 +aI7913 +aI7914 +aI7915 +aI7916 +aI7917 +aI7918 +aI7919 +aI7920 +aI7921 +aI7922 +aI7923 +aI7924 +aI7925 +aI7926 +aI7927 +aI7928 +aI7929 +aI7930 +aI7931 +aI7932 +aI7933 +aI7934 +aI7935 +aI7936 +aI7937 +aI7938 +aI7939 +aI7940 +aI7941 +aI7942 +aI7943 +aI7944 +aI7945 +aI7946 +aI7947 +aI7948 +aI7949 +aI7950 +aI7951 +aI7952 +aI7953 +aI7954 +aI7955 +aI7956 +aI7957 +aI7958 +aI7959 +aI7960 +aI7961 +aI7962 +aI7963 +aI7964 +aI7965 +aI7966 +aI7967 +aI7968 +aI7969 +aI7970 +aI7971 +aI7972 +aI7973 +aI7974 +aI7975 +aI7976 +aI7977 +aI7978 +aI7979 +aI7980 +aI7981 +aI7982 +aI7983 +aI7984 +aI7985 +aI7986 +aI7987 +aI7988 +aI7989 +aI7990 +aI7991 +aI7992 +aI7993 +aI7994 +aI7995 +aI7996 +aI7997 +aI7998 +aI7999 +aI8000 +aI8001 +aI8002 +aI8003 +aI8004 +aI8005 +aI8006 +aI8007 +aI8008 +aI8009 +aI8010 +aI8011 +aI8012 +aI8013 +aI8014 +aI8015 +aI8016 +aI8017 +aI8018 +aI8019 +aI8020 +aI8021 +aI8022 +aI8023 +aI8024 +aI8025 +aI8026 +aI8027 +aI8028 +aI8029 +aI8030 +aI8031 +aI8032 +aI8033 +aI8034 +aI8035 +aI8036 +aI8037 +aI8038 +aI8039 +aI8040 +aI8041 +aI8042 +aI8043 +aI8044 +aI8045 +aI8046 +aI8047 +aI8048 +aI8049 +aI8050 +aI8051 +aI8052 +aI8053 +aI8054 +aI8055 +aI8056 +aI8057 +aI8058 +aI8059 +aI8060 +aI8061 +aI8062 +aI8063 +aI8064 +aI8065 +aI8066 +aI8067 +aI8068 +aI8069 +aI8070 +aI8071 +aI8072 +aI8073 +aI8074 +aI8075 +aI8076 +aI8077 +aI8078 +aI8079 +aI8080 +aI8081 +aI8082 +aI8083 +aI8084 +aI8085 +aI8086 +aI8087 +aI8088 +aI8089 +aI8090 +aI8091 +aI8092 +aI8093 +aI8094 +aI8095 +aI8096 +aI8097 +aI8098 +aI8099 +aI8100 +aI8101 +aI8102 +aI8103 +aI8104 +aI8105 +aI8106 +aI8107 +aI8108 +aI8109 +aI8110 +aI8111 +aI8112 +aI8113 +aI8114 +aI8115 +aI8116 +aI8117 +aI8118 +aI8119 +aI8120 +aI8121 +aI8122 +aI8123 +aI8124 +aI8125 +aI8126 +aI8127 +aI8128 +aI8129 +aI8130 +aI8131 +aI8132 +aI8133 +aI8134 +aI8135 +aI8136 +aI8137 +aI8138 +aI8139 +aI8140 +aI8141 +aI8142 +aI8143 +aI8144 +aI8145 +aI8146 +aI8147 +aI8148 +aI8149 +aI8150 +aI8151 +aI8152 +aI8153 +aI8154 +aI8155 +aI8156 +aI8157 +aI8158 +aI8159 +aI8160 +aI8161 +aI8162 +aI8163 +aI8164 +aI8165 +aI8166 +aI8167 +aI8168 +aI8169 +aI8170 +aI8171 +aI8172 +aI8173 +aI8174 +aI8175 +aI8176 +aI8177 +aI8178 +aI8179 +aI8180 +aI8181 +aI8182 +aI8183 +aI8184 +aI8185 +aI8186 +aI8187 +aI8188 +aI8189 +aI8190 +aI8191 +aI8192 +aI8193 +aI8194 +aI8195 +aI8196 +aI8197 +aI8198 +aI8199 +aI8200 +aI8201 +aI8202 +aI8203 +aI8204 +aI8205 +aI8206 +aI8207 +aI8208 +aI8209 +aI8210 +aI8211 +aI8212 +aI8213 +aI8214 +aI8215 +aI8216 +aI8217 +aI8218 +aI8219 +aI8220 +aI8221 +aI8222 +aI8223 +aI8224 +aI8225 +aI8226 +aI8227 +aI8228 +aI8229 +aI8230 +aI8231 +aI8232 +aI8233 +aI8234 +aI8235 +aI8236 +aI8237 +aI8238 +aI8239 +aI8240 +aI8241 +aI8242 +aI8243 +aI8244 +aI8245 +aI8246 +aI8247 +aI8248 +aI8249 +aI8250 +aI8251 +aI8252 +aI8253 +aI8254 +aI8255 +aI8256 +aI8257 +aI8258 +aI8259 +aI8260 +aI8261 +aI8262 +aI8263 +aI8264 +aI8265 +aI8266 +aI8267 +aI8268 +aI8269 +aI8270 +aI8271 +aI8272 +aI8273 +aI8274 +aI8275 +aI8276 +aI8277 +aI8278 +aI8279 +aI8280 +aI8281 +aI8282 +aI8283 +aI8284 +aI8285 +aI8286 +aI8287 +aI8288 +aI8289 +aI8290 +aI8291 +aI8292 +aI8293 +aI8294 +aI8295 +aI8296 +aI8297 +aI8298 +aI8299 +aI8300 +aI8301 +aI8302 +aI8303 +aI8304 +aI8305 +aI8306 +aI8307 +aI8308 +aI8309 +aI8310 +aI8311 +aI8312 +aI8313 +aI8314 +aI8315 +aI8316 +aI8317 +aI8318 +aI8319 +aI8320 +aI8321 +aI8322 +aI8323 +aI8324 +aI8325 +aI8326 +aI8327 +aI8328 +aI8329 +aI8330 +aI8331 +aI8332 +aI8333 +aI8334 +aI8335 +aI8336 +aI8337 +aI8338 +aI8339 +aI8340 +aI8341 +aI8342 +aI8343 +aI8344 +aI8345 +aI8346 +aI8347 +aI8348 +aI8349 +aI8350 +aI8351 +aI8352 +aI8353 +aI8354 +aI8355 +aI8356 +aI8357 +aI8358 +aI8359 +aI8360 +aI8361 +aI8362 +aI8363 +aI8364 +aI8365 +aI8366 +aI8367 +aI8368 +aI8369 +aI8370 +aI8371 +aI8372 +aI8373 +aI8374 +aI8375 +aI8376 +aI8377 +aI8378 +aI8379 +aI8380 +aI8381 +aI8382 +aI8383 +aI8384 +aI8385 +aI8386 +aI8387 +aI8388 +aI8389 +aI8390 +aI8391 +aI8392 +aI8393 +aI8394 +aI8395 +aI8396 +aI8397 +aI8398 +aI8399 +aI8400 +aI8401 +aI8402 +aI8403 +aI8404 +aI8405 +aI8406 +aI8407 +aI8408 +aI8409 +aI8410 +aI8411 +aI8412 +aI8413 +aI8414 +aI8415 +aI8416 +aI8417 +aI8418 +aI8419 +aI8420 +aI8421 +aI8422 +aI8423 +aI8424 +aI8425 +aI8426 +aI8427 +aI8428 +aI8429 +aI8430 +aI8431 +aI8432 +aI8433 +aI8434 +aI8435 +aI8436 +aI8437 +aI8438 +aI8439 +aI8440 +aI8441 +aI8442 +aI8443 +aI8444 +aI8445 +aI8446 +aI8447 +aI8448 +aI8449 +aI8450 +aI8451 +aI8452 +aI8453 +aI8454 +aI8455 +aI8456 +aI8457 +aI8458 +aI8459 +aI8460 +aI8461 +aI8462 +aI8463 +aI8464 +aI8465 +aI8466 +aI8467 +aI8468 +aI8469 +aI8470 +aI8471 +aI8472 +aI8473 +aI8474 +aI8475 +aI8476 +aI8477 +aI8478 +aI8479 +aI8480 +aI8481 +aI8482 +aI8483 +aI8484 +aI8485 +aI8486 +aI8487 +aI8488 +aI8489 +aI8490 +aI8491 +aI8492 +aI8493 +aI8494 +aI8495 +aI8496 +aI8497 +aI8498 +aI8499 +aI8500 +aI8501 +aI8502 +aI8503 +aI8504 +aI8505 +aI8506 +aI8507 +aI8508 +aI8509 +aI8510 +aI8511 +aI8512 +aI8513 +aI8514 +aI8515 +aI8516 +aI8517 +aI8518 +aI8519 +aI8520 +aI8521 +aI8522 +aI8523 +aI8524 +aI8525 +aI8526 +aI8527 +aI8528 +aI8529 +aI8530 +aI8531 +aI8532 +aI8533 +aI8534 +aI8535 +aI8536 +aI8537 +aI8538 +aI8539 +aI8540 +aI8541 +aI8542 +aI8543 +aI8544 +aI8545 +aI8546 +aI8547 +aI8548 +aI8549 +aI8550 +aI8551 +aI8552 +aI8553 +aI8554 +aI8555 +aI8556 +aI8557 +aI8558 +aI8559 +aI8560 +aI8561 +aI8562 +aI8563 +aI8564 +aI8565 +aI8566 +aI8567 +aI8568 +aI8569 +aI8570 +aI8571 +aI8572 +aI8573 +aI8574 +aI8575 +aI8576 +aI8577 +aI8578 +aI8579 +aI8580 +aI8581 +aI8582 +aI8583 +aI8584 +aI8585 +aI8586 +aI8587 +aI8588 +aI8589 +aI8590 +aI8591 +aI8592 +aI8593 +aI8594 +aI8595 +aI8596 +aI8597 +aI8598 +aI8599 +aI8600 +aI8601 +aI8602 +aI8603 +aI8604 +aI8605 +aI8606 +aI8607 +aI8608 +aI8609 +aI8610 +aI8611 +aI8612 +aI8613 +aI8614 +aI8615 +aI8616 +aI8617 +aI8618 +aI8619 +aI8620 +aI8621 +aI8622 +aI8623 +aI8624 +aI8625 +aI8626 +aI8627 +aI8628 +aI8629 +aI8630 +aI8631 +aI8632 +aI8633 +aI8634 +aI8635 +aI8636 +aI8637 +aI8638 +aI8639 +aI8640 +aI8641 +aI8642 +aI8643 +aI8644 +aI8645 +aI8646 +aI8647 +aI8648 +aI8649 +aI8650 +aI8651 +aI8652 +aI8653 +aI8654 +aI8655 +aI8656 +aI8657 +aI8658 +aI8659 +aI8660 +aI8661 +aI8662 +aI8663 +aI8664 +aI8665 +aI8666 +aI8667 +aI8668 +aI8669 +aI8670 +aI8671 +aI8672 +aI8673 +aI8674 +aI8675 +aI8676 +aI8677 +aI8678 +aI8679 +aI8680 +aI8681 +aI8682 +aI8683 +aI8684 +aI8685 +aI8686 +aI8687 +aI8688 +aI8689 +aI8690 +aI8691 +aI8692 +aI8693 +aI8694 +aI8695 +aI8696 +aI8697 +aI8698 +aI8699 +aI8700 +aI8701 +aI8702 +aI8703 +aI8704 +aI8705 +aI8706 +aI8707 +aI8708 +aI8709 +aI8710 +aI8711 +aI8712 +aI8713 +aI8714 +aI8715 +aI8716 +aI8717 +aI8718 +aI8719 +aI8720 +aI8721 +aI8722 +aI8723 +aI8724 +aI8725 +aI8726 +aI8727 +aI8728 +aI8729 +aI8730 +aI8731 +aI8732 +aI8733 +aI8734 +aI8735 +aI8736 +aI8737 +aI8738 +aI8739 +aI8740 +aI8741 +aI8742 +aI8743 +aI8744 +aI8745 +aI8746 +aI8747 +aI8748 +aI8749 +aI8750 +aI8751 +aI8752 +aI8753 +aI8754 +aI8755 +aI8756 +aI8757 +aI8758 +aI8759 +aI8760 +aI8761 +aI8762 +aI8763 +aI8764 +aI8765 +aI8766 +aI8767 +aI8768 +aI8769 +aI8770 +aI8771 +aI8772 +aI8773 +aI8774 +aI8775 +aI8776 +aI8777 +aI8778 +aI8779 +aI8780 +aI8781 +aI8782 +aI8783 +aI8784 +aI8785 +aI8786 +aI8787 +aI8788 +aI8789 +aI8790 +aI8791 +aI8792 +aI8793 +aI8794 +aI8795 +aI8796 +aI8797 +aI8798 +aI8799 +aI8800 +aI8801 +aI8802 +aI8803 +aI8804 +aI8805 +aI8806 +aI8807 +aI8808 +aI8809 +aI8810 +aI8811 +aI8812 +aI8813 +aI8814 +aI8815 +aI8816 +aI8817 +aI8818 +aI8819 +aI8820 +aI8821 +aI8822 +aI8823 +aI8824 +aI8825 +aI8826 +aI8827 +aI8828 +aI8829 +aI8830 +aI8831 +aI8832 +aI8833 +aI8834 +aI8835 +aI8836 +aI8837 +aI8838 +aI8839 +aI8840 +aI8841 +aI8842 +aI8843 +aI8844 +aI8845 +aI8846 +aI8847 +aI8848 +aI8849 +aI8850 +aI8851 +aI8852 +aI8853 +aI8854 +aI8855 +aI8856 +aI8857 +aI8858 +aI8859 +aI8860 +aI8861 +aI8862 +aI8863 +aI8864 +aI8865 +aI8866 +aI8867 +aI8868 +aI8869 +aI8870 +aI8871 +aI8872 +aI8873 +aI8874 +aI8875 +aI8876 +aI8877 +aI8878 +aI8879 +aI8880 +aI8881 +aI8882 +aI8883 +aI8884 +aI8885 +aI8886 +aI8887 +aI8888 +aI8889 +aI8890 +aI8891 +aI8892 +aI8893 +aI8894 +aI8895 +aI8896 +aI8897 +aI8898 +aI8899 +aI8900 +aI8901 +aI8902 +aI8903 +aI8904 +aI8905 +aI8906 +aI8907 +aI8908 +aI8909 +aI8910 +aI8911 +aI8912 +aI8913 +aI8914 +aI8915 +aI8916 +aI8917 +aI8918 +aI8919 +aI8920 +aI8921 +aI8922 +aI8923 +aI8924 +aI8925 +aI8926 +aI8927 +aI8928 +aI8929 +aI8930 +aI8931 +aI8932 +aI8933 +aI8934 +aI8935 +aI8936 +aI8937 +aI8938 +aI8939 +aI8940 +aI8941 +aI8942 +aI8943 +aI8944 +aI8945 +aI8946 +aI8947 +aI8948 +aI8949 +aI8950 +aI8951 +aI8952 +aI8953 +aI8954 +aI8955 +aI8956 +aI8957 +aI8958 +aI8959 +aI8960 +aI8961 +aI8962 +aI8963 +aI8964 +aI8965 +aI8966 +aI8967 +aI8968 +aI8969 +aI8970 +aI8971 +aI8972 +aI8973 +aI8974 +aI8975 +aI8976 +aI8977 +aI8978 +aI8979 +aI8980 +aI8981 +aI8982 +aI8983 +aI8984 +aI8985 +aI8986 +aI8987 +aI8988 +aI8989 +aI8990 +aI8991 +aI8992 +aI8993 +aI8994 +aI8995 +aI8996 +aI8997 +aI8998 +aI8999 +aI9000 +aI9001 +aI9002 +aI9003 +aI9004 +aI9005 +aI9006 +aI9007 +aI9008 +aI9009 +aI9010 +aI9011 +aI9012 +aI9013 +aI9014 +aI9015 +aI9016 +aI9017 +aI9018 +aI9019 +aI9020 +aI9021 +aI9022 +aI9023 +aI9024 +aI9025 +aI9026 +aI9027 +aI9028 +aI9029 +aI9030 +aI9031 +aI9032 +aI9033 +aI9034 +aI9035 +aI9036 +aI9037 +aI9038 +aI9039 +aI9040 +aI9041 +aI9042 +aI9043 +aI9044 +aI9045 +aI9046 +aI9047 +aI9048 +aI9049 +aI9050 +aI9051 +aI9052 +aI9053 +aI9054 +aI9055 +aI9056 +aI9057 +aI9058 +aI9059 +aI9060 +aI9061 +aI9062 +aI9063 +aI9064 +aI9065 +aI9066 +aI9067 +aI9068 +aI9069 +aI9070 +aI9071 +aI9072 +aI9073 +aI9074 +aI9075 +aI9076 +aI9077 +aI9078 +aI9079 +aI9080 +aI9081 +aI9082 +aI9083 +aI9084 +aI9085 +aI9086 +aI9087 +aI9088 +aI9089 +aI9090 +aI9091 +aI9092 +aI9093 +aI9094 +aI9095 +aI9096 +aI9097 +aI9098 +aI9099 +aI9100 +aI9101 +aI9102 +aI9103 +aI9104 +aI9105 +aI9106 +aI9107 +aI9108 +aI9109 +aI9110 +aI9111 +aI9112 +aI9113 +aI9114 +aI9115 +aI9116 +aI9117 +aI9118 +aI9119 +aI9120 +aI9121 +aI9122 +aI9123 +aI9124 +aI9125 +aI9126 +aI9127 +aI9128 +aI9129 +aI9130 +aI9131 +aI9132 +aI9133 +aI9134 +aI9135 +aI9136 +aI9137 +aI9138 +aI9139 +aI9140 +aI9141 +aI9142 +aI9143 +aI9144 +aI9145 +aI9146 +aI9147 +aI9148 +aI9149 +aI9150 +aI9151 +aI9152 +aI9153 +aI9154 +aI9155 +aI9156 +aI9157 +aI9158 +aI9159 +aI9160 +aI9161 +aI9162 +aI9163 +aI9164 +aI9165 +aI9166 +aI9167 +aI9168 +aI9169 +aI9170 +aI9171 +aI9172 +aI9173 +aI9174 +aI9175 +aI9176 +aI9177 +aI9178 +aI9179 +aI9180 +aI9181 +aI9182 +aI9183 +aI9184 +aI9185 +aI9186 +aI9187 +aI9188 +aI9189 +aI9190 +aI9191 +aI9192 +aI9193 +aI9194 +aI9195 +aI9196 +aI9197 +aI9198 +aI9199 +aI9200 +aI9201 +aI9202 +aI9203 +aI9204 +aI9205 +aI9206 +aI9207 +aI9208 +aI9209 +aI9210 +aI9211 +aI9212 +aI9213 +aI9214 +aI9215 +aI9216 +aI9217 +aI9218 +aI9219 +aI9220 +aI9221 +aI9222 +aI9223 +aI9224 +aI9225 +aI9226 +aI9227 +aI9228 +aI9229 +aI9230 +aI9231 +aI9232 +aI9233 +aI9234 +aI9235 +aI9236 +aI9237 +aI9238 +aI9239 +aI9240 +aI9241 +aI9242 +aI9243 +aI9244 +aI9245 +aI9246 +aI9247 +aI9248 +aI9249 +aI9250 +aI9251 +aI9252 +aI9253 +aI9254 +aI9255 +aI9256 +aI9257 +aI9258 +aI9259 +aI9260 +aI9261 +aI9262 +aI9263 +aI9264 +aI9265 +aI9266 +aI9267 +aI9268 +aI9269 +aI9270 +aI9271 +aI9272 +aI9273 +aI9274 +aI9275 +aI9276 +aI9277 +aI9278 +aI9279 +aI9280 +aI9281 +aI9282 +aI9283 +aI9284 +aI9285 +aI9286 +aI9287 +aI9288 +aI9289 +aI9290 +aI9291 +aI9292 +aI9293 +aI9294 +aI9295 +aI9296 +aI9297 +aI9298 +aI9299 +aI9300 +aI9301 +aI9302 +aI9303 +aI9304 +aI9305 +aI9306 +aI9307 +aI9308 +aI9309 +aI9310 +aI9311 +aI9312 +aI9313 +aI9314 +aI9315 +aI9316 +aI9317 +aI9318 +aI9319 +aI9320 +aI9321 +aI9322 +aI9323 +aI9324 +aI9325 +aI9326 +aI9327 +aI9328 +aI9329 +aI9330 +aI9331 +aI9332 +aI9333 +aI9334 +aI9335 +aI9336 +aI9337 +aI9338 +aI9339 +aI9340 +aI9341 +aI9342 +aI9343 +aI9344 +aI9345 +aI9346 +aI9347 +aI9348 +aI9349 +aI9350 +aI9351 +aI9352 +aI9353 +aI9354 +aI9355 +aI9356 +aI9357 +aI9358 +aI9359 +aI9360 +aI9361 +aI9362 +aI9363 +aI9364 +aI9365 +aI9366 +aI9367 +aI9368 +aI9369 +aI9370 +aI9371 +aI9372 +aI9373 +aI9374 +aI9375 +aI9376 +aI9377 +aI9378 +aI9379 +aI9380 +aI9381 +aI9382 +aI9383 +aI9384 +aI9385 +aI9386 +aI9387 +aI9388 +aI9389 +aI9390 +aI9391 +aI9392 +aI9393 +aI9394 +aI9395 +aI9396 +aI9397 +aI9398 +aI9399 +aI9400 +aI9401 +aI9402 +aI9403 +aI9404 +aI9405 +aI9406 +aI9407 +aI9408 +aI9409 +aI9410 +aI9411 +aI9412 +aI9413 +aI9414 +aI9415 +aI9416 +aI9417 +aI9418 +aI9419 +aI9420 +aI9421 +aI9422 +aI9423 +aI9424 +aI9425 +aI9426 +aI9427 +aI9428 +aI9429 +aI9430 +aI9431 +aI9432 +aI9433 +aI9434 +aI9435 +aI9436 +aI9437 +aI9438 +aI9439 +aI9440 +aI9441 +aI9442 +aI9443 +aI9444 +aI9445 +aI9446 +aI9447 +aI9448 +aI9449 +aI9450 +aI9451 +aI9452 +aI9453 +aI9454 +aI9455 +aI9456 +aI9457 +aI9458 +aI9459 +aI9460 +aI9461 +aI9462 +aI9463 +aI9464 +aI9465 +aI9466 +aI9467 +aI9468 +aI9469 +aI9470 +aI9471 +aI9472 +aI9473 +aI9474 +aI9475 +aI9476 +aI9477 +aI9478 +aI9479 +aI9480 +aI9481 +aI9482 +aI9483 +aI9484 +aI9485 +aI9486 +aI9487 +aI9488 +aI9489 +aI9490 +aI9491 +aI9492 +aI9493 +aI9494 +aI9495 +aI9496 +aI9497 +aI9498 +aI9499 +aI9500 +aI9501 +aI9502 +aI9503 +aI9504 +aI9505 +aI9506 +aI9507 +aI9508 +aI9509 +aI9510 +aI9511 +aI9512 +aI9513 +aI9514 +aI9515 +aI9516 +aI9517 +aI9518 +aI9519 +aI9520 +aI9521 +aI9522 +aI9523 +aI9524 +aI9525 +aI9526 +aI9527 +aI9528 +aI9529 +aI9530 +aI9531 +aI9532 +aI9533 +aI9534 +aI9535 +aI9536 +aI9537 +aI9538 +aI9539 +aI9540 +aI9541 +aI9542 +aI9543 +aI9544 +aI9545 +aI9546 +aI9547 +aI9548 +aI9549 +aI9550 +aI9551 +aI9552 +aI9553 +aI9554 +aI9555 +aI9556 +aI9557 +aI9558 +aI9559 +aI9560 +aI9561 +aI9562 +aI9563 +aI9564 +aI9565 +aI9566 +aI9567 +aI9568 +aI9569 +aI9570 +aI9571 +aI9572 +aI9573 +aI9574 +aI9575 +aI9576 +aI9577 +aI9578 +aI9579 +aI9580 +aI9581 +aI9582 +aI9583 +aI9584 +aI9585 +aI9586 +aI9587 +aI9588 +aI9589 +aI9590 +aI9591 +aI9592 +aI9593 +aI9594 +aI9595 +aI9596 +aI9597 +aI9598 +aI9599 +aI9600 +aI9601 +aI9602 +aI9603 +aI9604 +aI9605 +aI9606 +aI9607 +aI9608 +aI9609 +aI9610 +aI9611 +aI9612 +aI9613 +aI9614 +aI9615 +aI9616 +aI9617 +aI9618 +aI9619 +aI9620 +aI9621 +aI9622 +aI9623 +aI9624 +aI9625 +aI9626 +aI9627 +aI9628 +aI9629 +aI9630 +aI9631 +aI9632 +aI9633 +aI9634 +aI9635 +aI9636 +aI9637 +aI9638 +aI9639 +aI9640 +aI9641 +aI9642 +aI9643 +aI9644 +aI9645 +aI9646 +aI9647 +aI9648 +aI9649 +aI9650 +aI9651 +aI9652 +aI9653 +aI9654 +aI9655 +aI9656 +aI9657 +aI9658 +aI9659 +aI9660 +aI9661 +aI9662 +aI9663 +aI9664 +aI9665 +aI9666 +aI9667 +aI9668 +aI9669 +aI9670 +aI9671 +aI9672 +aI9673 +aI9674 +aI9675 +aI9676 +aI9677 +aI9678 +aI9679 +aI9680 +aI9681 +aI9682 +aI9683 +aI9684 +aI9685 +aI9686 +aI9687 +aI9688 +aI9689 +aI9690 +aI9691 +aI9692 +aI9693 +aI9694 +aI9695 +aI9696 +aI9697 +aI9698 +aI9699 +aI9700 +aI9701 +aI9702 +aI9703 +aI9704 +aI9705 +aI9706 +aI9707 +aI9708 +aI9709 +aI9710 +aI9711 +aI9712 +aI9713 +aI9714 +aI9715 +aI9716 +aI9717 +aI9718 +aI9719 +aI9720 +aI9721 +aI9722 +aI9723 +aI9724 +aI9725 +aI9726 +aI9727 +aI9728 +aI9729 +aI9730 +aI9731 +aI9732 +aI9733 +aI9734 +aI9735 +aI9736 +aI9737 +aI9738 +aI9739 +aI9740 +aI9741 +aI9742 +aI9743 +aI9744 +aI9745 +aI9746 +aI9747 +aI9748 +aI9749 +aI9750 +aI9751 +aI9752 +aI9753 +aI9754 +aI9755 +aI9756 +aI9757 +aI9758 +aI9759 +aI9760 +aI9761 +aI9762 +aI9763 +aI9764 +aI9765 +aI9766 +aI9767 +aI9768 +aI9769 +aI9770 +aI9771 +aI9772 +aI9773 +aI9774 +aI9775 +aI9776 +aI9777 +aI9778 +aI9779 +aI9780 +aI9781 +aI9782 +aI9783 +aI9784 +aI9785 +aI9786 +aI9787 +aI9788 +aI9789 +aI9790 +aI9791 +aI9792 +aI9793 +aI9794 +aI9795 +aI9796 +aI9797 +aI9798 +aI9799 +aI9800 +aI9801 +aI9802 +aI9803 +aI9804 +aI9805 +aI9806 +aI9807 +aI9808 +aI9809 +aI9810 +aI9811 +aI9812 +aI9813 +aI9814 +aI9815 +aI9816 +aI9817 +aI9818 +aI9819 +aI9820 +aI9821 +aI9822 +aI9823 +aI9824 +aI9825 +aI9826 +aI9827 +aI9828 +aI9829 +aI9830 +aI9831 +aI9832 +aI9833 +aI9834 +aI9835 +aI9836 +aI9837 +aI9838 +aI9839 +aI9840 +aI9841 +aI9842 +aI9843 +aI9844 +aI9845 +aI9846 +aI9847 +aI9848 +aI9849 +aI9850 +aI9851 +aI9852 +aI9853 +aI9854 +aI9855 +aI9856 +aI9857 +aI9858 +aI9859 +aI9860 +aI9861 +aI9862 +aI9863 +aI9864 +aI9865 +aI9866 +aI9867 +aI9868 +aI9869 +aI9870 +aI9871 +aI9872 +aI9873 +aI9874 +aI9875 +aI9876 +aI9877 +aI9878 +aI9879 +aI9880 +aI9881 +aI9882 +aI9883 +aI9884 +aI9885 +aI9886 +aI9887 +aI9888 +aI9889 +aI9890 +aI9891 +aI9892 +aI9893 +aI9894 +aI9895 +aI9896 +aI9897 +aI9898 +aI9899 +aI9900 +aI9901 +aI9902 +aI9903 +aI9904 +aI9905 +aI9906 +aI9907 +aI9908 +aI9909 +aI9910 +aI9911 +aI9912 +aI9913 +aI9914 +aI9915 +aI9916 +aI9917 +aI9918 +aI9919 +aI9920 +aI9921 +aI9922 +aI9923 +aI9924 +aI9925 +aI9926 +aI9927 +aI9928 +aI9929 +aI9930 +aI9931 +aI9932 +aI9933 +aI9934 +aI9935 +aI9936 +aI9937 +aI9938 +aI9939 +aI9940 +aI9941 +aI9942 +aI9943 +aI9944 +aI9945 +aI9946 +aI9947 +aI9948 +aI9949 +aI9950 +aI9951 +aI9952 +aI9953 +aI9954 +aI9955 +aI9956 +aI9957 +aI9958 +aI9959 +aI9960 +aI9961 +aI9962 +aI9963 +aI9964 +aI9965 +aI9966 +aI9967 +aI9968 +aI9969 +aI9970 +aI9971 +aI9972 +aI9973 +aI9974 +aI9975 +aI9976 +aI9977 +aI9978 +aI9979 +aI9980 +aI9981 +aI9982 +aI9983 +aI9984 +aI9985 +aI9986 +aI9987 +aI9988 +aI9989 +aI9990 +aI9991 +aI9992 +aI9993 +aI9994 +aI9995 +aI9996 +aI9997 +aI9998 +as. \ No newline at end of file diff --git a/2code/22903.dat b/2code/22903.dat new file mode 100644 index 0000000..3ddfe1a Binary files /dev/null and b/2code/22903.dat differ diff --git a/2code/23301.db b/2code/23301.db new file mode 100644 index 0000000..3a102e7 Binary files /dev/null and b/2code/23301.db differ diff --git a/2code/23301.sqlite b/2code/23301.sqlite new file mode 100644 index 0000000..3a102e7 Binary files /dev/null and b/2code/23301.sqlite differ diff --git a/2code/23401.xlsx b/2code/23401.xlsx new file mode 100644 index 0000000..c52b2ff Binary files /dev/null and b/2code/23401.xlsx differ diff --git a/2code/23501.py b/2code/23501.py new file mode 100644 index 0000000..f4b40b2 --- /dev/null +++ b/2code/23501.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python +# coding=utf-8 + +#read_file = open("23501.txt") +#write_file = open("23502.txt", "w") + +#try: +# r = read_file.readlines() +# for line in r: +# write_file.write(line) +#finally: +# read_file.close() +# write_file.close() + +with open("23501.txt") as read_file, open("23503.txt", "w") as write_file: + for line in read_file.readlines(): + write_file.write(line) + + diff --git a/2code/23501.txt b/2code/23501.txt new file mode 100644 index 0000000..b325dac --- /dev/null +++ b/2code/23501.txt @@ -0,0 +1,2 @@ +hello laoqi +www.itdiffer.com diff --git a/2code/23502.py b/2code/23502.py new file mode 100644 index 0000000..c286065 --- /dev/null +++ b/2code/23502.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# coding=utf-8 + +class ContextManagerOpenDemo(object): + def __init__(self, filename, mode): + self.filename = filename + self.mode = mode + + def __enter__(self): + print "Starting the Manager." + self.open_file = open(self.filename, self.mode) + return self.open_file + + #def __exit__(self, *others): + # self.open_file.close() + # print "Exiting the Manager." + + def __exit__(self, exc_type, exc_value, exc_traceback): + #return SyntaxError != exc_type + return False + +with ContextManagerOpenDemo("23501.txt", 'r') as reader: + print "In the Manager." + for line in reader: + print lines + diff --git a/2code/23502.txt b/2code/23502.txt new file mode 100644 index 0000000..b325dac --- /dev/null +++ b/2code/23502.txt @@ -0,0 +1,2 @@ +hello laoqi +www.itdiffer.com diff --git a/2code/23502p3.py b/2code/23502p3.py new file mode 100644 index 0000000..220098e --- /dev/null +++ b/2code/23502p3.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# coding=utf-8 + +class ContextManagerOpenDemo(object): + def __init__(self, filename, mode): + self.filename = filename + self.mode = mode + + def __enter__(self): + print("Starting the Manager.") + self.open_file = open(self.filename, self.mode) + return self.open_file + + def __exit__(self, *others): + self.open_file.close() + print("Exiting the Manager.") + + #def __exit__(self, exc_type, exc_value, exc_traceback): + #return SyntaxError != exc_type + #return False + +with ContextManagerOpenDemo("23501.txt", 'r') as reader: +#with ContextManagerOpenDemo(): + print("In the Manager.") + for line in reader: + print(line) + diff --git a/2code/23503.py b/2code/23503.py new file mode 100644 index 0000000..8c27566 --- /dev/null +++ b/2code/23503.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# coding=utf-8 + +import cairo +from contextlib import contextmanager + +@contextmanager +def saved(cr): + cr.save() + try: + yield cr + finally: + cr.restore() + +def tree(angle): + cr.move_to(0, 0) + cr.translate(0, -65) + cr.line_to(0, 0) + cr.stroke() + cr.scale(0.72, 0.72) + if angle > 0.72: + for a in [-angle, angle]: + with saved(cr): + cr.rotate(a) + tree(angle * 0.75) + +surf = cairo.ImageSurface(cairo.FORMAT_ARGB32, 280, 204) +cr = cairo.Context(surf) +cr.translate(140, 203) +cr.set_line_width(5) +tree(0.75) +surf.write_to_png('fractal-tree.png') diff --git a/2code/23504.py b/2code/23504.py new file mode 100644 index 0000000..b43f99f --- /dev/null +++ b/2code/23504.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# coding=utf-8 + +from contextlib import contextmanager + +@contextmanager +def demo(): + print "before yield." + yield "contextmanager demo." + print "after yield." + +with demo() as dd: + print "the word is: %s" % dd + diff --git a/2code/23901.py b/2code/23901.py new file mode 100644 index 0000000..346600f --- /dev/null +++ b/2code/23901.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +class RoundFloat(object): + def __init__(self, val): + assert isinstance(val, float), "value must be a float." + self.value = round(val, 2) + + def __str__(self): + return "{:.2f}".format(self.value) + + __repr__ = __str__ + + #def __repr__(self): + # return self.__str__() + +if __name__ == "__main__": + r = RoundFloat(2.185) + print r + print type(r) diff --git a/2code/23901p3.py b/2code/23901p3.py new file mode 100644 index 0000000..6a38fe7 --- /dev/null +++ b/2code/23901p3.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +class RoundFloat: + def __init__(self, val): + assert isinstance(val, float), "value must be a float." + self.value = round(val, 2) + + def __str__(self): + return "{:.2f}".format(self.value) + + __repr__ = __str__ + + #def __repr__(self): + # return self.__str__() + +if __name__ == "__main__": + r = RoundFloat(2.0) + print(r) + print(type(r)) diff --git a/2code/24001p3.py b/2code/24001p3.py new file mode 100644 index 0000000..1e6d469 --- /dev/null +++ b/2code/24001p3.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# coding=utf-8 + +class Rectangle(object): + + def __init__(self): + self.width = 0 + self.length = 0 + + def setSize(self, size): + self.width, self.length = size + def getSize(self): + return self.width, self.length + +if __name__ == "__main__": + r = Rectangle() + r.width = 3 + r.length = 4 + print(r.getSize()) + r.setSize( (30, 40) ) + print(r.width) + print(r.length) diff --git a/2code/24201.py b/2code/24201.py new file mode 100644 index 0000000..7db5964 --- /dev/null +++ b/2code/24201.py @@ -0,0 +1,9 @@ + +def foo(): + a = 3 + def bar(): + return a + return bar + +f = foo() +print f() diff --git a/2code/24202.py b/2code/24202.py new file mode 100644 index 0000000..7062c93 --- /dev/null +++ b/2code/24202.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +# coding:utf-8 + +def parabola(a, b, c): + def para(x): + return a*x**2 + b*x + c + return para + +p = parabola(2, 3, 4) +print p(5) diff --git a/2code/__init__.py b/2code/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/2code/fractal-tree.png b/2code/fractal-tree.png new file mode 100644 index 0000000..2910b0d Binary files /dev/null and b/2code/fractal-tree.png differ diff --git a/2code/newtemp.py b/2code/newtemp.py new file mode 100644 index 0000000..1e99dab --- /dev/null +++ b/2code/newtemp.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +# coding=utf-8 + +print "This is a tmp file." diff --git a/2code/pm.py b/2code/pm.py new file mode 100644 index 0000000..ff7fa98 --- /dev/null +++ b/2code/pm.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +# coding=utf-8 + +""" +This is a document of the python module. +""" + +def lang(): + return "python" + +if __name__ == "__main__": + print lang() diff --git a/2code/pm.pyc b/2code/pm.pyc new file mode 100644 index 0000000..84fffb7 Binary files /dev/null and b/2code/pm.pyc differ diff --git a/2code/pp.py b/2code/pp.py new file mode 100644 index 0000000..0ea8c07 --- /dev/null +++ b/2code/pp.py @@ -0,0 +1,13 @@ +# /usr/bin/env python +# coding:utf-8 + +__all__ = ['_private_variable', 'public_teacher'] + +public_variable = "Hello, I am a public variable." +_private_variable = "Hi, I am a private variable." + +def public_teacher(): + print "I am a public teacher, I am from JP." + +def _private_teacher(): + print "I am a private teacher, I am from CN." diff --git a/2code/pp.pyc b/2code/pp.pyc new file mode 100644 index 0000000..9e3f7c0 Binary files /dev/null and b/2code/pp.pyc differ diff --git a/2code/stdout.md b/2code/stdout.md new file mode 100644 index 0000000..96e9190 --- /dev/null +++ b/2code/stdout.md @@ -0,0 +1 @@ +Learn Python: From Beginner to Master diff --git a/2images/20101.png b/2images/20101.png new file mode 100644 index 0000000..d634a99 Binary files /dev/null and b/2images/20101.png differ diff --git a/2images/20102.png b/2images/20102.png new file mode 100644 index 0000000..c8ecaf3 Binary files /dev/null and b/2images/20102.png differ diff --git a/2images/20401.png b/2images/20401.png new file mode 100644 index 0000000..aca4706 Binary files /dev/null and b/2images/20401.png differ diff --git a/2images/20801.png b/2images/20801.png new file mode 100644 index 0000000..6cfae4a Binary files /dev/null and b/2images/20801.png differ diff --git a/2images/20802.png b/2images/20802.png new file mode 100644 index 0000000..ad6adbe Binary files /dev/null and b/2images/20802.png differ diff --git a/2images/20803.png b/2images/20803.png new file mode 100644 index 0000000..ba8c15d Binary files /dev/null and b/2images/20803.png differ diff --git a/2images/21001.png b/2images/21001.png new file mode 100644 index 0000000..f2c8ff1 Binary files /dev/null and b/2images/21001.png differ diff --git a/2images/21002.png b/2images/21002.png new file mode 100644 index 0000000..d085580 Binary files /dev/null and b/2images/21002.png differ diff --git a/2images/22301.jpg b/2images/22301.jpg new file mode 100644 index 0000000..ffb616f Binary files /dev/null and b/2images/22301.jpg differ diff --git a/2images/22302.jpg b/2images/22302.jpg new file mode 100644 index 0000000..65c1453 Binary files /dev/null and b/2images/22302.jpg differ diff --git a/2images/22303.jpg b/2images/22303.jpg new file mode 100644 index 0000000..8f3efa7 Binary files /dev/null and b/2images/22303.jpg differ diff --git a/2images/22304.jpg b/2images/22304.jpg new file mode 100644 index 0000000..98f7306 Binary files /dev/null and b/2images/22304.jpg differ diff --git a/2images/22305.jpg b/2images/22305.jpg new file mode 100644 index 0000000..a181188 Binary files /dev/null and b/2images/22305.jpg differ diff --git a/2images/22306.jpg b/2images/22306.jpg new file mode 100644 index 0000000..473bbbe Binary files /dev/null and b/2images/22306.jpg differ diff --git a/2images/22307.jpg b/2images/22307.jpg new file mode 100644 index 0000000..bd69f78 Binary files /dev/null and b/2images/22307.jpg differ diff --git a/2images/22308.jpg b/2images/22308.jpg new file mode 100644 index 0000000..09ae326 Binary files /dev/null and b/2images/22308.jpg differ diff --git a/2images/22309.jpg b/2images/22309.jpg new file mode 100644 index 0000000..a3e6f17 Binary files /dev/null and b/2images/22309.jpg differ diff --git a/2images/22310.jpg b/2images/22310.jpg new file mode 100644 index 0000000..ba3a06d Binary files /dev/null and b/2images/22310.jpg differ diff --git a/2images/22311.jpg b/2images/22311.jpg new file mode 100644 index 0000000..fe35199 Binary files /dev/null and b/2images/22311.jpg differ diff --git a/2images/22501.jpg b/2images/22501.jpg new file mode 100644 index 0000000..f79ba00 Binary files /dev/null and b/2images/22501.jpg differ diff --git a/2images/22601.jpg b/2images/22601.jpg new file mode 100644 index 0000000..9538cf1 Binary files /dev/null and b/2images/22601.jpg differ diff --git a/2images/23201.jpg b/2images/23201.jpg new file mode 100644 index 0000000..ea6db16 Binary files /dev/null and b/2images/23201.jpg differ diff --git a/2images/23401.jpg b/2images/23401.jpg new file mode 100644 index 0000000..726934f Binary files /dev/null and b/2images/23401.jpg differ diff --git a/2images/23402.jpg b/2images/23402.jpg new file mode 100644 index 0000000..00ce8f4 Binary files /dev/null and b/2images/23402.jpg differ diff --git a/3code/31301.py b/3code/31301.py new file mode 100644 index 0000000..03c35c6 --- /dev/null +++ b/3code/31301.py @@ -0,0 +1,37 @@ +#! /usr/bin/env python +# coding = utf-8 + +import pandas +import pandas.io.data +import datetime +import urllib2 +import csv + +YAHOO = "http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=sd1ohgl1vl1" + +def get_quote_today(symbol): + response = urllib2.urlopen(YAHOO % symbol) + reader = csv.reader(response, delimiter=",", quotechar='"') + for row in reader: + if row[0] == symbol: + return row + +def main(): + symbol = "BABA" + + history = pandas.io.data.DataReader(symbol, "yahoo", start="2014/11/11") + print history.tail(3) + + today = datetime.date.today() + df = pandas.DataFrame( columns=["Open", "High", "Low", "Close", "Volume", "Adj Close"], dtype=float) + + row = get_quote_today(symbol) + df.ix[0] = map(float, row[2:]) + + history = history.append(df) + + print "today is %s" % today + print history.tail(2) + +if __name__ == "__main__": + main() diff --git a/3code/hello.py b/3code/hello.py new file mode 100644 index 0000000..0b7e126 --- /dev/null +++ b/3code/hello.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# coding=utf-8 + +import tornado.httpserver +import tornado.ioloop +import tornado.options +import tornado.web + +from tornado.options import define, options +define("port", default=8000, help="run on the given port", type=int) + +class IndexHandler(tornado.web.RequestHandler): + def get(self): + greeting = self.get_argument('greeting', 'Helloi World') + self.write(greeting + '\nwelcome you to read: www.itdiffer.com') + +if __name__ == "__main__": + tornado.options.parse_command_line() + app = tornado.web.Application(handlers=[(r"/", IndexHandler)]) + http_server = tornado.httpserver.HTTPServer(app) + http_server.listen(options.port) + tornado.ioloop.IOLoop.instance().start() diff --git a/3code/marks.csv b/3code/marks.csv new file mode 100644 index 0000000..2aedd49 --- /dev/null +++ b/3code/marks.csv @@ -0,0 +1,5 @@ +name,physics,python,math,english +Google,100,100,25,12 +Facebook,45,54,44,88 +Twitter,54,76,13,91 +Yahoo,54,452,26,100 diff --git a/3code/marks.xlsx b/3code/marks.xlsx new file mode 100644 index 0000000..02e2dff Binary files /dev/null and b/3code/marks.xlsx differ diff --git a/3code/web/application.py b/3code/web/application.py new file mode 100644 index 0000000..67030df --- /dev/null +++ b/3code/web/application.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python +# coding=utf-8 + +from url import url + +import tornado.web +import os + +setting = dict( + template_path = os.path.join(os.path.dirname(__file__), "templates"), + static_path = os.path.join(os.path.dirname(__file__), "statics"), + cookie_secret = "bZJc2sWbQLKos6GkHn/VB9oXwQt8S0R0kRvJ5/xJ89E=", + xsrf_cookies = True, + login_url = '/', +) +application = tornado.web.Application( + handlers = url, + **setting +) diff --git a/3code/web/application.pyc b/3code/web/application.pyc new file mode 100644 index 0000000..f701403 Binary files /dev/null and b/3code/web/application.pyc differ diff --git a/3code/web/handlers/__init__.py b/3code/web/handlers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/3code/web/handlers/__init__.pyc b/3code/web/handlers/__init__.pyc new file mode 100644 index 0000000..e48b75b Binary files /dev/null and b/3code/web/handlers/__init__.pyc differ diff --git a/3code/web/handlers/base.py b/3code/web/handlers/base.py new file mode 100644 index 0000000..2eb5fbf --- /dev/null +++ b/3code/web/handlers/base.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +# coding=utf-8 + +import tornado.web + +class BaseHandler(tornado.web.RequestHandler): + def get_current_user(self): + return self.get_secure_cookie("user") + + diff --git a/3code/web/handlers/base.pyc b/3code/web/handlers/base.pyc new file mode 100644 index 0000000..737b3eb Binary files /dev/null and b/3code/web/handlers/base.pyc differ diff --git a/3code/web/handlers/index.py b/3code/web/handlers/index.py new file mode 100644 index 0000000..7626e38 --- /dev/null +++ b/3code/web/handlers/index.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# coding=utf-8 + +#import tornado.web +import tornado.escape +import methods.readdb as mrd +from base import BaseHandler + +class IndexHandler(BaseHandler): + def get(self): + usernames = mrd.select_columns(table="users",column="username") + one_user = usernames[0][0] + self.render("index.html", user=one_user) + + def post(self): + username = self.get_argument("username") + password = self.get_argument("password") + user_infos = mrd.select_table(table="users",column="*",condition="username",value=username) + if user_infos: + db_pwd = user_infos[0][2] + if db_pwd == password: + #self.set_secure_cookie('user', username) + self.set_current_user(username) + self.write(username) + else: + self.write("-1") + else: + self.write("-1") + + def set_current_user(self, user): + if user: + self.set_secure_cookie('user', tornado.escape.json_encode(user)) + #self.set_secure_cookie('user', user) + else: + self.clear_cookie("user") + +class ErrorHandler(BaseHandler): + def get(self): + self.render("error.html") + +class RegisterHandler(BaseHandler): + def get(self): + self.render("register.html") + + def post(self): + pass diff --git a/3code/web/handlers/index.pyc b/3code/web/handlers/index.pyc new file mode 100644 index 0000000..074f283 Binary files /dev/null and b/3code/web/handlers/index.pyc differ diff --git a/3code/web/handlers/sleep.py b/3code/web/handlers/sleep.py new file mode 100644 index 0000000..7fcb0e9 --- /dev/null +++ b/3code/web/handlers/sleep.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +# coding=utf-8 + +from base import BaseHandler + +import time + +class SleepHandler(BaseHandler): + def get(self): + time.sleep(17) + self.render("sleep.html") + +class SeeHandler(BaseHandler): + def get(self): + self.render("see.html") diff --git a/3code/web/handlers/sleep.pyc b/3code/web/handlers/sleep.pyc new file mode 100644 index 0000000..213dc6c Binary files /dev/null and b/3code/web/handlers/sleep.pyc differ diff --git a/3code/web/handlers/user.py b/3code/web/handlers/user.py new file mode 100644 index 0000000..faddb26 --- /dev/null +++ b/3code/web/handlers/user.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# coding=utf-8 + +import tornado.web +import tornado.escape +import methods.readdb as mrd +from base import BaseHandler + +class UserHandler(BaseHandler): + @tornado.web.authenticated + def get(self): + #username = self.get_argument("user") + username = tornado.escape.json_decode(self.current_user) + print username + print type(username) + user_infos = mrd.select_table(table="users",column="*",condition="username",value=username) + print user_infos + self.render("user.html", users = user_infos) diff --git a/3code/web/handlers/user.pyc b/3code/web/handlers/user.pyc new file mode 100644 index 0000000..4b77f8d Binary files /dev/null and b/3code/web/handlers/user.pyc differ diff --git a/3code/web/methods/__init__.py b/3code/web/methods/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/3code/web/methods/__init__.pyc b/3code/web/methods/__init__.pyc new file mode 100644 index 0000000..4567084 Binary files /dev/null and b/3code/web/methods/__init__.pyc differ diff --git a/3code/web/methods/db.py b/3code/web/methods/db.py new file mode 100644 index 0000000..56ad749 --- /dev/null +++ b/3code/web/methods/db.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python +# coding=utf-8 + +import MySQLdb + +conn = MySQLdb.connect(host="localhost", user="root", passwd="123123", db="qiwsirtest", port=3306, charset="utf8") + +cur = conn.cursor() diff --git a/3code/web/methods/db.pyc b/3code/web/methods/db.pyc new file mode 100644 index 0000000..42b2804 Binary files /dev/null and b/3code/web/methods/db.pyc differ diff --git a/3code/web/methods/readdb.py b/3code/web/methods/readdb.py new file mode 100644 index 0000000..cb47eda --- /dev/null +++ b/3code/web/methods/readdb.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# coding=utf-8 + +from db import * + +def select_table(table, column, condition, value ): + sql = "select " + column + " from " + table + " where " + condition + "='" + value + "'" + cur.execute(sql) + lines = cur.fetchall() + return lines + + +def select_columns(table, column ): + sql = "select " + column + " from " + table + cur.execute(sql) + lines = cur.fetchall() + return lines + diff --git a/3code/web/methods/readdb.pyc b/3code/web/methods/readdb.pyc new file mode 100644 index 0000000..5ef029a Binary files /dev/null and b/3code/web/methods/readdb.pyc differ diff --git a/3code/web/server.py b/3code/web/server.py new file mode 100644 index 0000000..9b35bbc --- /dev/null +++ b/3code/web/server.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +# coding=utf-8 + +import tornado.ioloop +import tornado.options +import tornado.httpserver + +from application import application + +from tornado.options import define, options + +define("port", default = 8000, help = "run on the given port", type = int) + +def main(): + tornado.options.parse_command_line() + http_server = tornado.httpserver.HTTPServer(application) + http_server.listen(options.port) + + print "Development server is running at http://127.0.0.1:%s" % options.port + print "Quit the server with Control-C" + + tornado.ioloop.IOLoop.instance().start() + +if __name__ == "__main__": + main() diff --git a/3code/web/statics/css/style.css b/3code/web/statics/css/style.css new file mode 100644 index 0000000..7efd3c0 --- /dev/null +++ b/3code/web/statics/css/style.css @@ -0,0 +1,4 @@ + +body { + color:red; +} diff --git a/3code/web/statics/js/jquery.min.js b/3code/web/statics/js/jquery.min.js new file mode 100644 index 0000000..0f60b7b --- /dev/null +++ b/3code/web/statics/js/jquery.min.js @@ -0,0 +1,5 @@ +/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ +!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; + +return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/\s*$/g,ra={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:k.htmlSerialize?[0,"",""]:[1,"X
","
"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?""!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("