摘要: #!/usr/bin/python # -*- coding: utf8 -*- import os a = os.popen("dir").read() a print(a) 面向对象(Object-Oriented Programming) OOP 面向对象三大特性是继承、封装、多态 class 阅读全文
posted @ 2016-03-05 16:46 QiRaining 阅读(184) 评论(0) 推荐(0)
摘要: 迭代器Iterators迭代器仅是一容器对象,它实现了迭代器协议。它有两个基本方法:next方法返回容器的下一个元素__iter__方法返回迭代器自身 生成器Generators 二分查找 def BinarySearch(a, target): low = 0 high = len(a) - 1 阅读全文
posted @ 2016-02-18 09:46 QiRaining 阅读(135) 评论(0) 推荐(0)
摘要: 字典 dic = { "省":{ "市": ['县'] } } dic.keys() dic["省"].keys() dic["省"]["市"] 返回的都是列表 列组 索引 index 切片 [:] 追加 append 删除 del remove pop 长度 len 循环 for while br 阅读全文
posted @ 2016-01-27 14:59 QiRaining 阅读(124) 评论(0) 推荐(0)
摘要: Python语言介绍安装Python大体有两个版本,分别是Python2.x版本和Python3.x,而Python3.x版本是不向下兼容,但是由于项目需求,我们有时候要Python2.x和Python3.x共存。我们只需要更改一些环境变量就行。(主要是Windows下面的环境)。你会看到我这里有两... 阅读全文
posted @ 2016-01-20 15:04 QiRaining 阅读(146) 评论(0) 推荐(0)