<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[August17的博客]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/August17</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; August17]]></copyright><item><title><![CDATA[安装MongoDB]]></title><link>https://blog.csdn.net/August17/article/details/90037803</link><guid>https://blog.csdn.net/August17/article/details/90037803</guid><author>August17</author><pubDate>Thu, 09 May 2019 15:43:01 +0800</pubDate><description><![CDATA[https://blog.csdn.net/my2016/article/details/50673504
]]></description><category></category></item><item><title><![CDATA[IO编程]]></title><link>https://blog.csdn.net/August17/article/details/78735569</link><guid>https://blog.csdn.net/August17/article/details/78735569</guid><author>August17</author><pubDate>Wed, 06 Dec 2017 21:42:21 +0800</pubDate><description><![CDATA[读文件f = open('xxx/xx/x.text', 'r')r表示读。.text表示读取文本文件。 
文件不存在的话，就会跑出一个IOError错误。 
文件成功打开，调用read().f.read()文件使用完后要关闭。f.close()二进制文件 
如图片，视频等等，用’rb’模式打开。f = open('xxx/xx/x.ipg', 'rb')字符编码 
读取非UTF-8编码的文本文件，]]></description><category></category></item><item><title><![CDATA[面向对象高级编程]]></title><link>https://blog.csdn.net/August17/article/details/78688943</link><guid>https://blog.csdn.net/August17/article/details/78688943</guid><author>August17</author><pubDate>Fri, 01 Dec 2017 17:25:31 +0800</pubDate><description><![CDATA[绑定属性class Student(object):
    pass
s = Student()
s.name = 'ann'  #给实例绑定属性
print(s.name)_slots_限制实例属性class Student(object):
    __slots__ = ('name', 'age')  # 用tuple定义允许绑定的属性名称在创建实例之后，绑定实例属性score就会出错误。]]></description><category></category></item><item><title><![CDATA[【Python】类]]></title><link>https://blog.csdn.net/August17/article/details/78648614</link><guid>https://blog.csdn.net/August17/article/details/78648614</guid><author>August17</author><pubDate>Mon, 27 Nov 2017 20:19:11 +0800</pubDate><description><![CDATA[面向对象编程 
类 
定义：是一个抽象的模板。 
通过关键字class来定义。 
class + 类名（object）class Student（object）类名首字母一般是大写。object表示该类从哪个类继承下来。实例 
定义：根据类创建出的一个个具体的对象。 
实例 = 类名（）bart = Student（）bart指向Studen的实例。 
可以给实例绑定属性。bart.name = ‘]]></description><category></category></item><item><title><![CDATA[【Python】高阶函数（2）]]></title><link>https://blog.csdn.net/August17/article/details/78534499</link><guid>https://blog.csdn.net/August17/article/details/78534499</guid><author>August17</author><pubDate>Tue, 14 Nov 2017 20:12:00 +0800</pubDate><description><![CDATA[sorted（）sorted()函数也是一个高阶函数，它还可以接收一个key函数来实现自定义的排序。key指定的函数将作用于list的每一个元素上，并根据key函数返回的结果进行排序。练习：假设我们用一组tuple表示学生名字和成绩：
  L = [(‘Bob’, 75), (‘Adam’, 92), (‘Bart’, 66), (‘Lisa’, 88)]
请用sorted()对上述列表分别按名字排]]></description><category></category></item><item><title><![CDATA[【Python】高阶函数（1）]]></title><link>https://blog.csdn.net/August17/article/details/78533528</link><guid>https://blog.csdn.net/August17/article/details/78533528</guid><author>August17</author><pubDate>Tue, 14 Nov 2017 18:28:38 +0800</pubDate><description><![CDATA[把str转换为int的函数：>>> from functools import reduce
>>> def fn(x, y):
...     return x * 10 + y
...
>>> def char2num(s):
...     return {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8':]]></description><category></category></item><item><title><![CDATA[【Python】生成器和杨辉三角]]></title><link>https://blog.csdn.net/August17/article/details/78524966</link><guid>https://blog.csdn.net/August17/article/details/78524966</guid><author>August17</author><pubDate>Mon, 13 Nov 2017 21:26:18 +0800</pubDate><description><![CDATA[生成器在python中，一边循环一边计算的机制，称为生成器（generator）。generator保存的是算法，它也是可迭代对象。练习：杨辉三角把每一行看做一个list，试写一个generator，不断输出下一行的list：# 期待输出:
# [1]
# [1, 1]
# [1, 2, 1]
# [1, 3, 3, 1]
# [1, 4, 6, 4, 1]
# [1, 5, 10, 10, 5,]]></description><category></category></item><item><title><![CDATA[【Python】列表生成式和利用内建函数判断是否是字符串]]></title><link>https://blog.csdn.net/August17/article/details/78518186</link><guid>https://blog.csdn.net/August17/article/details/78518186</guid><author>August17</author><pubDate>Mon, 13 Nov 2017 11:00:12 +0800</pubDate><description><![CDATA[列表生成式
[含有x的表达式   for x in 迭代   if条件（可选）]
对于for...in循环当中，如果每一次if条件都满足时，就可以执行含有x的表达式。利用if来筛选出想要的结果。


练习
如果list中既包含字符串，又包含整数，由于非字符串类型没有lower()方法，所以列表生成式会报错。
使用内建的isinstance函数可以判断一个变量是不是字符串。
请修改列]]></description><category></category></item><item><title><![CDATA[Python]]></title><link>https://blog.csdn.net/August17/article/details/78422902</link><guid>https://blog.csdn.net/August17/article/details/78422902</guid><author>August17</author><pubDate>Sat, 04 Nov 2017 10:17:17 +0800</pubDate><description><![CDATA[参数检查
调用函数的时候，如果是参数类型不对，内置函数能够检查出来，而定义函数不能检查出来。那么可以对定义函数设置参数检查，用内置函数isinstance（)实现：
def my_abs(x):
    if not isinstance(x, (int, float)):
        raise TypeError('bad operand type')
    if x >= 0:]]></description><category></category></item><item><title><![CDATA[欢迎使用CSDN-markdown编辑器]]></title><link>https://blog.csdn.net/August17/article/details/75150633</link><guid>https://blog.csdn.net/August17/article/details/75150633</guid><author>August17</author><pubDate>Sat, 15 Jul 2017 11:38:10 +0800</pubDate><description><![CDATA[欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来，用它写博客，将会带来全新的体验哦：
Markdown和扩展Markdown简洁的语法
代码块高亮
图片链接和图片上传
LaTex数学公式
UML序列图和流程图
离线写博客
导入导出Markdown文件
丰富的快捷键
快捷键
加粗    Ctrl + B 
斜体    Ctrl + I 
引用    Ctrl]]></description><category></category></item></channel></rss>