diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 00000000..d8654aa0
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+python
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 00000000..d8210482
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 00000000..9c8328fb
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 00000000..614b3c13
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/python.iml b/.idea/python.iml
new file mode 100644
index 00000000..d0876a78
--- /dev/null
+++ b/.idea/python.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml
new file mode 100644
index 00000000..922003b8
--- /dev/null
+++ b/.idea/scopes/scope_settings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 00000000..94a25f7f
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 00000000..1415580d
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,557 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Python
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1423208759222
+
+ 1423208759222
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/burness/0000/test.py b/burness/0000/test.py
index c94f806c..eea3a012 100644
--- a/burness/0000/test.py
+++ b/burness/0000/test.py
@@ -1,16 +1,19 @@
from PIL import Image, ImageDraw, ImageFont
class Image_unread_message:
- def open(self,path):
- self.im=Image.open(path)
- return True
+
def __init__(self):
self.fnt=None
self.im=None
+ def open(self,path):
+ self.im=Image.open(path)
+ return True
+
def setFont(self,font_path,size):
self.fnt=ImageFont.truetype(font_path,size)
return True
+
def draw_text(self,position,str,colour,fnt):
draw=ImageDraw.Draw(self.im)
draw.text(position,str,fill=colour,font=fnt)
@@ -24,5 +27,3 @@ def draw_text(self,position,str,colour,fnt):
test.setFont('ahronbd.ttf',80)
test.draw_text((160,-20),'4',(255,0,0),test.fnt)
-
-
diff --git a/renzongxian/0000/0000.py b/renzongxian/0000/0000.py
index aee19fc0..29d0515b 100644
--- a/renzongxian/0000/0000.py
+++ b/renzongxian/0000/0000.py
@@ -2,12 +2,7 @@
# Author:renzongxian
# Date:2014-11-30
# Python 3.4
-
-"""
-
-第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果
-
-"""
+# coding=utf-8
from PIL import Image, ImageDraw, ImageFont
import sys
diff --git a/xiaolud/0000/0000-second.py b/xiaolud/0000/0000-second.py
new file mode 100644
index 00000000..825c67f2
--- /dev/null
+++ b/xiaolud/0000/0000-second.py
@@ -0,0 +1,40 @@
+# coding=utf-8
+
+'''
+将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。 类似于图中效果
+
+添加未读消息显示
+
+'''
+
+from PIL import Image,ImageDraw,ImageFont
+
+
+def img_font_content(img):
+
+ image_content = Image.open(img)
+ # 定义图片坐标
+ font_width = image_content.size[0] - image_content.size[0]/10
+ font_high = image_content.size[1]/10
+ return (image_content,font_width,font_high)
+
+
+def img_modify(img_font_content):
+
+ image_content,font_width,font_high = img_font_content
+ # 定义字体
+ font_content = ImageFont.truetype('ahronbd.ttf', 30)
+ # 修改并保存
+ draw_instance = ImageDraw.Draw(image_content)
+ draw_instance.text((font_width, font_high), '4', (255,0,0), font = font_content)
+ image_content.show()
+ image_content.save('weChat_avatar_modify.png')
+
+def main():
+
+ pre_img = img_font_content('weChat_avatar.png')
+ end_img = img_modify(pre_img)
+
+
+if __name__ == '__main__':
+ main()
\ No newline at end of file
diff --git a/xiaolud/0000/0000.py b/xiaolud/0000/0000.py
new file mode 100644
index 00000000..c1544e33
--- /dev/null
+++ b/xiaolud/0000/0000.py
@@ -0,0 +1,25 @@
+# coding=utf-8
+'''
+将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。 类似于图中效果
+添加未读消息显示
+'''
+
+
+
+
+from PIL import Image,ImageDraw,ImageFont
+
+# 加载图片信息
+image_content = Image.open('weChat_avatar.png')
+
+# 加载字体信息并定义字体坐标
+font_content = ImageFont.truetype('ahronbd.ttf', 30)
+
+font_width = image_content.size[0] - image_content.size[0]/10
+font_high = image_content.size[1]/10
+
+# 添加计数信息
+draw_instance = ImageDraw.Draw(image_content)
+draw_instance.text((font_width, font_high), '4', (255,0,0), font = font_content)
+image_content.show()
+image_content.save('weChat_avatar_modify.png')
diff --git a/xiaolud/0000/ahronbd.ttf b/xiaolud/0000/ahronbd.ttf
new file mode 100644
index 00000000..a0bd1911
Binary files /dev/null and b/xiaolud/0000/ahronbd.ttf differ
diff --git a/xiaolud/0000/weChat_avatar.png b/xiaolud/0000/weChat_avatar.png
new file mode 100644
index 00000000..f978a981
Binary files /dev/null and b/xiaolud/0000/weChat_avatar.png differ
diff --git a/xiaolud/0000/weChat_avatar_modify.png b/xiaolud/0000/weChat_avatar_modify.png
new file mode 100644
index 00000000..44c8c62c
Binary files /dev/null and b/xiaolud/0000/weChat_avatar_modify.png differ
diff --git a/xiaolud/0001/0002.py b/xiaolud/0001/0002.py
new file mode 100644
index 00000000..e3e281d7
--- /dev/null
+++ b/xiaolud/0001/0002.py
@@ -0,0 +1,11 @@
+#coding=utf-8
+#__author__ = 'Sean'
+
+'''
+做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
+
+'''
+
+import random
+
+
diff --git a/xiaolud/README.md b/xiaolud/README.md
new file mode 100755
index 00000000..68d11690
--- /dev/null
+++ b/xiaolud/README.md
@@ -0,0 +1,181 @@
+## Python 练习册,每天一个小程序 ##
+
+
+#### 说明: ####
+
+- Python 练习册,每天一个小程序。注:将 Python 换成其他语言,大多数题目也适用
+- 不会出现诸如「打印九九乘法表」、「打印水仙花」之类的题目
+- [点此链接,会看到每个题目的代码, 欢迎大家 Pull Request 出题目,贴代码(Gist、Blog皆可):-)](https://github.com/Show-Me-the-Code/python)
+- 本文本文由@史江歌(shijiangge@gmail.com QQ:499065469)根据互联网资料收集整理而成,感谢互联网,感谢各位的分享。鸣谢!本文会不断更新。
+
+> Talk is cheap. Show me the code.--Linus Torvalds
+
+----------
+
+**第 0000 题:**将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。
+类似于图中效果
+
+
+
+**第 0001 题:**做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用**生成激活码**(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
+
+**第 0002 题**:将 0001 题生成的 200 个激活码(或者优惠券)保存到 **MySQL** 关系型数据库中。
+
+**第 0003 题:**将 0001 题生成的 200 个激活码(或者优惠券)保存到 **Redis** 非关系型数据库中。
+
+**第 0004 题:**任一个英文的纯文本文件,统计其中的单词出现的个数。
+
+**第 0005 题:**你有一个目录,装了很多照片,把它们的尺寸变成都不大于 iPhone5 分辨率的大小。
+
+**第 0006 题:**你有一个目录,放了你一个月的日记,都是 txt,为了避免分词的问题,假设内容都是英文,请统计出你认为每篇日记最重要的词。
+
+**第 0007 题:**有个目录,里面是你自己写过的程序,统计一下你写过多少行代码。包括空行和注释,但是要分别列出来。
+
+**第 0008 题:**一个HTML文件,找出里面的**正文**。
+
+**第 0009 题:**一个HTML文件,找出里面的**链接**。
+
+**第 0010 题:**使用 Python 生成类似于下图中的**字母验证码图片**
+
+
+
+- [阅读资料](http://stackoverflow.com/questions/2823316/generate-a-random-letter-in-python)
+
+**第 0011 题:** 敏感词文本文件 filtered_words.txt,里面的内容为以下内容,当用户输入敏感词语时,则打印出 Freedom,否则打印出 Human Rights。
+
+ 北京
+ 程序员
+ 公务员
+ 领导
+ 牛比
+ 牛逼
+ 你娘
+ 你妈
+ love
+ sex
+ jiangge
+
+**第 0012 题:** 敏感词文本文件 filtered_words.txt,里面的内容 和 0011题一样,当用户输入敏感词语,则用 星号 * 替换,例如当用户输入「北京是个好城市」,则变成「**是个好城市」。
+
+**第 0013 题:** 用 Python 写一个爬图片的程序,爬 [这个链接里的日本妹子图片 :-)](http://tieba.baidu.com/p/2166231880)
+
+- [参考代码](http://www.v2ex.com/t/61686 "参考代码")
+
+**第 0014 题:** 纯文本文件 student.txt为学生信息, 里面的内容(包括花括号)如下所示:
+
+ {
+ "1":["张三",150,120,100],
+ "2":["李四",90,99,95],
+ "3":["王五",60,66,68]
+ }
+
+请将上述内容写到 student.xls 文件中,如下图所示:
+
+
+
+- [阅读资料](http://www.cnblogs.com/skynet/archive/2013/05/06/3063245.html) 腾讯游戏开发 XML 和 Excel 内容相互转换
+
+**第 0015 题:** 纯文本文件 city.txt为城市信息, 里面的内容(包括花括号)如下所示:
+
+ {
+ "1" : "上海",
+ "2" : "北京",
+ "3" : "成都"
+ }
+
+请将上述内容写到 city.xls 文件中,如下图所示:
+
+
+
+
+**第 0016 题:** 纯文本文件 numbers.txt, 里面的内容(包括方括号)如下所示:
+
+ [
+ [1, 82, 65535],
+ [20, 90, 13],
+ [26, 809, 1024]
+ ]
+
+请将上述内容写到 numbers.xls 文件中,如下图所示:
+
+
+
+**第 0017 题:** 将 第 0014 题中的 student.xls 文件中的内容写到 student.xml 文件中,如
+
+下所示:
+
+
+
+
+
+ {
+ "1" : ["张三", 150, 120, 100],
+ "2" : ["李四", 90, 99, 95],
+ "3" : ["王五", 60, 66, 68]
+ }
+
+
+
+- [阅读资料](http://www.cnblogs.com/skynet/archive/2013/05/06/3063245.html) 腾讯游戏开发 xml 和 Excel 相互转换
+
+**第 0018 题:** 将 第 0015 题中的 city.xls 文件中的内容写到 city.xml 文件中,如下所示:
+
+
+
+
+
+ {
+ "1" : "上海",
+ "2" : "北京",
+ "3" : "成都"
+ }
+
+
+
+**第 0019 题:** 将 第 0016 题中的 numbers.xls 文件中的内容写到 numbers.xml 文件中,如下
+
+所示:
+
+
+
+
+
+
+ [
+ [1, 82, 65535],
+ [20, 90, 13],
+ [26, 809, 1024]
+ ]
+
+
+
+
+**第 0020 题:** [登陆中国联通网上营业厅](http://iservice.10010.com/index_.html) 后选择「自助服务」 --> 「详单查询」,然后选择你要查询的时间段,点击「查询」按钮,查询结果页面的最下方,点击「导出」,就会生成类似于 2014年10月01日~2014年10月31日通话详单.xls 文件。写代码,对每月通话时间做个统计。
+
+**第 0021 题:** 通常,登陆某个网站或者 APP,需要使用用户名和密码。密码是如何加密后存储起来的呢?请使用 Python 对密码加密。
+
+- 阅读资料 [用户密码的存储与 Python 示例](http://zhuoqiang.me/password-storage-and-python-example.html)
+
+- 阅读资料 [Hashing Strings with Python](http://www.pythoncentral.io/hashing-strings-with-python/)
+
+- 阅读资料 [Python's safest method to store and retrieve passwords from a database](http://stackoverflow.com/questions/2572099/pythons-safest-method-to-store-and-retrieve-passwords-from-a-database)
+
+**第 0022 题:** iPhone 6、iPhone 6 Plus 早已上市开卖。请查看你写得 第 0005 题的代码是否可以复用。
+
+**第 0023 题:** 使用 Python 的 Web 框架,做一个 Web 版本 留言簿 应用。
+
+[阅读资料:Python 有哪些 Web 框架](http://v2ex.com/t/151643#reply53)
+
+- 
+
+
+**第 0024 题:** 使用 Python 的 Web 框架,做一个 Web 版本 TodoList 应用。
+
+- 