+
+
\ No newline at end of file
diff --git a/Lyndon1994/0024/__init__.py b/Lyndon1994/0024/__init__.py
new file mode 100644
index 00000000..40a96afc
--- /dev/null
+++ b/Lyndon1994/0024/__init__.py
@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-
diff --git a/Lyndon1994/0024/todo.py b/Lyndon1994/0024/todo.py
new file mode 100644
index 00000000..40a96afc
--- /dev/null
+++ b/Lyndon1994/0024/todo.py
@@ -0,0 +1 @@
+# -*- coding: utf-8 -*-
diff --git a/Lyndon1994/README.md b/Lyndon1994/README.md
new file mode 100644
index 00000000..7f9b1ae1
--- /dev/null
+++ b/Lyndon1994/README.md
@@ -0,0 +1,2 @@
+# Show-Me-the-Code
+Show Me the Code Python version. https://github.com/Show-Me-the-Code/python
diff --git a/Lyndon1994/source/0004-text.txt b/Lyndon1994/source/0004-text.txt
new file mode 100644
index 00000000..906dc1c9
--- /dev/null
+++ b/Lyndon1994/source/0004-text.txt
@@ -0,0 +1,7 @@
+Architects look at thousands of buildings during their training, and study critiques of those buildings written by masters. In contrast, most software developers only ever get to know a handful of large programs well—usually programs they wrote themselves—and never study the great programs of history. As a result, they repeat one another's mistakes rather than building on one another's successes.
+
+Our goal is to change that. In these two books, the authors of four dozen open source applications explain how their software is structured, and why. What are each program's major components? How do they interact? And what did their builders learn during their development? In answering these questions, the contributors to these books provide unique insights into how they think.
+
+If you are a junior developer, and want to learn how your more experienced colleagues think, these books are the place to start. If you are an intermediate or senior developer, and want to see how your peers have solved hard design problems, these books can help you too.
+
+Follow us on our blog at http://aosabook.org/blog/ or on Twitter at @aosabook and using the #aosa hashtag.
\ No newline at end of file
diff --git a/Lyndon1994/source/0005/pics/17fb7c2dc017eef4d839b311c35a09df18ff6861.jpg b/Lyndon1994/source/0005/pics/17fb7c2dc017eef4d839b311c35a09df18ff6861.jpg
new file mode 100644
index 00000000..c2239b3e
Binary files /dev/null and b/Lyndon1994/source/0005/pics/17fb7c2dc017eef4d839b311c35a09df18ff6861.jpg differ
diff --git a/Lyndon1994/source/0005/pics/1caf792fb6fe974a521128071ef41ef53881c99c.jpg b/Lyndon1994/source/0005/pics/1caf792fb6fe974a521128071ef41ef53881c99c.jpg
new file mode 100644
index 00000000..07934944
Binary files /dev/null and b/Lyndon1994/source/0005/pics/1caf792fb6fe974a521128071ef41ef53881c99c.jpg differ
diff --git a/Lyndon1994/source/0005/pics/21232fa7298b4bdfe4778c25ef24258f6cfb6327.jpg b/Lyndon1994/source/0005/pics/21232fa7298b4bdfe4778c25ef24258f6cfb6327.jpg
new file mode 100644
index 00000000..9e84c32b
Binary files /dev/null and b/Lyndon1994/source/0005/pics/21232fa7298b4bdfe4778c25ef24258f6cfb6327.jpg differ
diff --git a/Lyndon1994/source/0005/pics/348dd2ae5ff6deb6ef7b6bf9ab23e43cf8d8d2c5.jpg b/Lyndon1994/source/0005/pics/348dd2ae5ff6deb6ef7b6bf9ab23e43cf8d8d2c5.jpg
new file mode 100644
index 00000000..f69c3dec
Binary files /dev/null and b/Lyndon1994/source/0005/pics/348dd2ae5ff6deb6ef7b6bf9ab23e43cf8d8d2c5.jpg differ
diff --git a/Lyndon1994/source/0005/pics/46673332eec7befebb70e54652f68423dd15ffbb.jpg b/Lyndon1994/source/0005/pics/46673332eec7befebb70e54652f68423dd15ffbb.jpg
new file mode 100644
index 00000000..c6b9d2da
Binary files /dev/null and b/Lyndon1994/source/0005/pics/46673332eec7befebb70e54652f68423dd15ffbb.jpg differ
diff --git a/Lyndon1994/source/0005/pics/50c0ebe8f13d8c4889faaba4daec14c298fd78a7.jpg b/Lyndon1994/source/0005/pics/50c0ebe8f13d8c4889faaba4daec14c298fd78a7.jpg
new file mode 100644
index 00000000..2ae2800e
Binary files /dev/null and b/Lyndon1994/source/0005/pics/50c0ebe8f13d8c4889faaba4daec14c298fd78a7.jpg differ
diff --git a/Lyndon1994/source/0005/pics/5865440118a1550d8d27c4fdd9d28f6e9efaa99a.jpg b/Lyndon1994/source/0005/pics/5865440118a1550d8d27c4fdd9d28f6e9efaa99a.jpg
new file mode 100644
index 00000000..ffcfbda0
Binary files /dev/null and b/Lyndon1994/source/0005/pics/5865440118a1550d8d27c4fdd9d28f6e9efaa99a.jpg differ
diff --git a/Lyndon1994/source/0005/pics/7bf24be69bee676e503efc0b09caf484db5dd2b9.jpg b/Lyndon1994/source/0005/pics/7bf24be69bee676e503efc0b09caf484db5dd2b9.jpg
new file mode 100644
index 00000000..4e28f702
Binary files /dev/null and b/Lyndon1994/source/0005/pics/7bf24be69bee676e503efc0b09caf484db5dd2b9.jpg differ
diff --git a/Lyndon1994/source/0005/pics/8d1076bccf118eb0145495e3f1babbe1c3b30180.jpg b/Lyndon1994/source/0005/pics/8d1076bccf118eb0145495e3f1babbe1c3b30180.jpg
new file mode 100644
index 00000000..52b00d6f
Binary files /dev/null and b/Lyndon1994/source/0005/pics/8d1076bccf118eb0145495e3f1babbe1c3b30180.jpg differ
diff --git a/Lyndon1994/source/0005/pics/afe35fd64c190588d8bf4a657d02c52ceea875b6.jpg b/Lyndon1994/source/0005/pics/afe35fd64c190588d8bf4a657d02c52ceea875b6.jpg
new file mode 100644
index 00000000..85d18172
Binary files /dev/null and b/Lyndon1994/source/0005/pics/afe35fd64c190588d8bf4a657d02c52ceea875b6.jpg differ
diff --git a/Lyndon1994/source/0005/result/finish_17fb7c2dc017eef4d839b311c35a09df18ff6861.jpg b/Lyndon1994/source/0005/result/finish_17fb7c2dc017eef4d839b311c35a09df18ff6861.jpg
new file mode 100644
index 00000000..c2943bf5
Binary files /dev/null and b/Lyndon1994/source/0005/result/finish_17fb7c2dc017eef4d839b311c35a09df18ff6861.jpg differ
diff --git a/Lyndon1994/source/0005/result/finish_1caf792fb6fe974a521128071ef41ef53881c99c.jpg b/Lyndon1994/source/0005/result/finish_1caf792fb6fe974a521128071ef41ef53881c99c.jpg
new file mode 100644
index 00000000..482ee574
Binary files /dev/null and b/Lyndon1994/source/0005/result/finish_1caf792fb6fe974a521128071ef41ef53881c99c.jpg differ
diff --git a/Lyndon1994/source/0005/result/finish_21232fa7298b4bdfe4778c25ef24258f6cfb6327.jpg b/Lyndon1994/source/0005/result/finish_21232fa7298b4bdfe4778c25ef24258f6cfb6327.jpg
new file mode 100644
index 00000000..95ea9f45
Binary files /dev/null and b/Lyndon1994/source/0005/result/finish_21232fa7298b4bdfe4778c25ef24258f6cfb6327.jpg differ
diff --git a/Lyndon1994/source/0005/result/finish_348dd2ae5ff6deb6ef7b6bf9ab23e43cf8d8d2c5.jpg b/Lyndon1994/source/0005/result/finish_348dd2ae5ff6deb6ef7b6bf9ab23e43cf8d8d2c5.jpg
new file mode 100644
index 00000000..946153f6
Binary files /dev/null and b/Lyndon1994/source/0005/result/finish_348dd2ae5ff6deb6ef7b6bf9ab23e43cf8d8d2c5.jpg differ
diff --git a/Lyndon1994/source/0005/result/finish_46673332eec7befebb70e54652f68423dd15ffbb.jpg b/Lyndon1994/source/0005/result/finish_46673332eec7befebb70e54652f68423dd15ffbb.jpg
new file mode 100644
index 00000000..dcd407f8
Binary files /dev/null and b/Lyndon1994/source/0005/result/finish_46673332eec7befebb70e54652f68423dd15ffbb.jpg differ
diff --git a/Lyndon1994/source/0005/result/finish_50c0ebe8f13d8c4889faaba4daec14c298fd78a7.jpg b/Lyndon1994/source/0005/result/finish_50c0ebe8f13d8c4889faaba4daec14c298fd78a7.jpg
new file mode 100644
index 00000000..40347a93
Binary files /dev/null and b/Lyndon1994/source/0005/result/finish_50c0ebe8f13d8c4889faaba4daec14c298fd78a7.jpg differ
diff --git a/Lyndon1994/source/0005/result/finish_5865440118a1550d8d27c4fdd9d28f6e9efaa99a.jpg b/Lyndon1994/source/0005/result/finish_5865440118a1550d8d27c4fdd9d28f6e9efaa99a.jpg
new file mode 100644
index 00000000..78a1ff40
Binary files /dev/null and b/Lyndon1994/source/0005/result/finish_5865440118a1550d8d27c4fdd9d28f6e9efaa99a.jpg differ
diff --git a/Lyndon1994/source/0005/result/finish_7bf24be69bee676e503efc0b09caf484db5dd2b9.jpg b/Lyndon1994/source/0005/result/finish_7bf24be69bee676e503efc0b09caf484db5dd2b9.jpg
new file mode 100644
index 00000000..73f0e40f
Binary files /dev/null and b/Lyndon1994/source/0005/result/finish_7bf24be69bee676e503efc0b09caf484db5dd2b9.jpg differ
diff --git a/Lyndon1994/source/0005/result/finish_8d1076bccf118eb0145495e3f1babbe1c3b30180.jpg b/Lyndon1994/source/0005/result/finish_8d1076bccf118eb0145495e3f1babbe1c3b30180.jpg
new file mode 100644
index 00000000..8f0caec6
Binary files /dev/null and b/Lyndon1994/source/0005/result/finish_8d1076bccf118eb0145495e3f1babbe1c3b30180.jpg differ
diff --git a/Lyndon1994/source/0005/result/finish_afe35fd64c190588d8bf4a657d02c52ceea875b6.jpg b/Lyndon1994/source/0005/result/finish_afe35fd64c190588d8bf4a657d02c52ceea875b6.jpg
new file mode 100644
index 00000000..7cdf1f2a
Binary files /dev/null and b/Lyndon1994/source/0005/result/finish_afe35fd64c190588d8bf4a657d02c52ceea875b6.jpg differ
diff --git a/Lyndon1994/source/0006/1.txt b/Lyndon1994/source/0006/1.txt
new file mode 100644
index 00000000..254a2332
--- /dev/null
+++ b/Lyndon1994/source/0006/1.txt
@@ -0,0 +1,7 @@
+Dethe is a geek dad, aesthetic programmer, mentor, and creator of the Waterbear visual programming tool. He co-hosts the Vancouver Maker Education Salons and wants to fill the world with robotic origami rabbits.
+
+In block-based programming languages, you write programs by dragging and connecting blocks that represent parts of the program. Block-based languages differ from conventional programming languages, in which you type words and symbols.
+
+Learning a programming language can be difficult because they are extremely sensitive to even the slightest of typos. Most programming languages are case-sensitive, have obscure syntax, and will refuse to run if you get so much as a semicolon in the wrong place—or worse, leave one out. Further, most programming languages in use today are based on English and their syntax cannot be localized.
+
+In contrast, a well-done block language can eliminate syntax errors completely. You can still create a program which does the wrong thing, but you cannot create one with the wrong syntax: the blocks just won't fit that way. Block languages are more discoverable: you can see all the constructs and libraries of the language right in the list of blocks. Further, blocks can be localized into any human language without changing the meaning of the programming language.
\ No newline at end of file
diff --git a/Lyndon1994/source/0006/2.txt b/Lyndon1994/source/0006/2.txt
new file mode 100644
index 00000000..f1fc4500
--- /dev/null
+++ b/Lyndon1994/source/0006/2.txt
@@ -0,0 +1,7 @@
+Block-based languages have a long history, with some of the prominent ones being Lego Mindstorms, Alice3D, StarLogo, and especially Scratch. There are several tools for block-based programming on the web as well: Blockly, AppInventor, Tynker, and many more.
+
+The code in this chapter is loosely based on the open-source project Waterbear, which is not a language but a tool for wrapping existing languages with a block-based syntax. Advantages of such a wrapper include the ones noted above: eliminating syntax errors, visual display of available components, ease of localization. Additionally, visual code can sometimes be easier to read and debug, and blocks can be used by pre-typing children. (We could even go further and put icons on the blocks, either in conjunction with the text names or instead of them, to allow pre-literate children to write programs, but we don't go that far in this example.)
+
+The choice of turtle graphics for this language goes back to the Logo language, which was created specifically to teach programming to children. Several of the block-based languages above include turtle graphics, and it is a small enough domain to be able to capture in a tightly constrained project such as this.
+
+If you would like to get a feel for what a block-based-language is like, you can experiment with the program that is built in this chapter from author's GitHub repository.
\ No newline at end of file
diff --git a/Lyndon1994/source/0006/3.txt b/Lyndon1994/source/0006/3.txt
new file mode 100644
index 00000000..f477eaad
--- /dev/null
+++ b/Lyndon1994/source/0006/3.txt
@@ -0,0 +1,6 @@
+Goals and Structure
+I want to accomplish a couple of things with this code. First and foremost, I want to implement a block language for turtle graphics, with which you can write code to create images through simple dragging-and-dropping of blocks, using as simple a structure of HTML, CSS, and JavaScript as possible. Second, but still important, I want to show how the blocks themselves can serve as a framework for other languages besides our mini turtle language.
+
+To do this, we encapsulate everything that is specific to the turtle language into one file (turtle.js) that we can easily swap with another file. Nothing else should be specific to the turtle language; the rest should just be about handling the blocks (blocks.js and menu.js) or be generally useful web utilities (util.js, drag.js, file.js). That is the goal, although to maintain the small size of the project, some of those utilities are less general-purpose and more specific to their use with the blocks.
+
+One thing that struck me when writing a block language was that the language is its own IDE. You can't just code up blocks in your favourite text editor; the IDE has to be designed and developed in parallel with the block language. This has some pros and cons. On the plus side, everyone will use a consistent environment and there is no room for religious wars about what editor to use. On the downside, it can be a huge distraction from building the block language itself.
\ No newline at end of file
diff --git a/Lyndon1994/source/0011/filtered_words.txt b/Lyndon1994/source/0011/filtered_words.txt
new file mode 100644
index 00000000..69373b64
--- /dev/null
+++ b/Lyndon1994/source/0011/filtered_words.txt
@@ -0,0 +1,11 @@
+北京
+程序员
+公务员
+领导
+牛比
+牛逼
+你娘
+你妈
+love
+sex
+jiangge
\ No newline at end of file
diff --git a/Lyndon1994/source/0014/student.txt b/Lyndon1994/source/0014/student.txt
new file mode 100644
index 00000000..f06a601f
--- /dev/null
+++ b/Lyndon1994/source/0014/student.txt
@@ -0,0 +1,5 @@
+{
+ "1":["张三",150,120,100],
+ "2":["李四",90,99,95],
+ "3":["王五",60,66,68]
+}
\ No newline at end of file
diff --git a/Lyndon1994/source/0014/student.xls b/Lyndon1994/source/0014/student.xls
new file mode 100644
index 00000000..c8a41564
Binary files /dev/null and b/Lyndon1994/source/0014/student.xls differ
diff --git a/Lyndon1994/source/0014/student.xml b/Lyndon1994/source/0014/student.xml
new file mode 100644
index 00000000..9f7d7661
--- /dev/null
+++ b/Lyndon1994/source/0014/student.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+ {
+ "1":["张三",150,120,100],
+ "2":["李四",90,99,95],
+ "3":["王五",60,66,68]
+}
+
+
+
\ No newline at end of file
diff --git a/Lyndon1994/source/0015/city.txt b/Lyndon1994/source/0015/city.txt
new file mode 100644
index 00000000..312f5c19
--- /dev/null
+++ b/Lyndon1994/source/0015/city.txt
@@ -0,0 +1,5 @@
+{
+ "1" : "上海",
+ "2" : "北京",
+ "3" : "成都"
+}
\ No newline at end of file
diff --git a/Lyndon1994/source/0015/city.xls b/Lyndon1994/source/0015/city.xls
new file mode 100644
index 00000000..1809fe86
Binary files /dev/null and b/Lyndon1994/source/0015/city.xls differ
diff --git "a/Lyndon1994/source/0020/2017\345\271\26403\346\234\210\350\257\255\351\237\263\351\200\232\344\277\241.xls" "b/Lyndon1994/source/0020/2017\345\271\26403\346\234\210\350\257\255\351\237\263\351\200\232\344\277\241.xls"
new file mode 100644
index 00000000..6f77a985
Binary files /dev/null and "b/Lyndon1994/source/0020/2017\345\271\26403\346\234\210\350\257\255\351\237\263\351\200\232\344\277\241.xls" differ
diff --git a/NKUCodingCat/0024/0024.sql b/NKUCodingCat/0024/0024.sql
deleted file mode 100644
index a07fa402..00000000
--- a/NKUCodingCat/0024/0024.sql
+++ /dev/null
@@ -1,67 +0,0 @@
-# SQL-Front 5.1 (Build 4.16)
-
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE */;
-/*!40101 SET SQL_MODE='NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES */;
-/*!40103 SET SQL_NOTES='ON' */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS */;
-/*!40014 SET UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS */;
-/*!40014 SET FOREIGN_KEY_CHECKS=0 */;
-
-
-# Host: localhost Database: 0024
-# ------------------------------------------------------
-# Server version 5.5.38
-
-DROP DATABASE IF EXISTS `0024`;
-CREATE DATABASE `0024` /*!40100 DEFAULT CHARACTER SET utf8 */;
-USE `0024`;
-
-#
-# Source for table code
-#
-
-DROP TABLE IF EXISTS `code`;
-CREATE TABLE `code` (
- `id` int(20) NOT NULL DEFAULT '0',
- `to` text NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-#
-# Dumping data for table code
-#
-
-LOCK TABLES `code` WRITE;
-/*!40000 ALTER TABLE `code` DISABLE KEYS */;
-INSERT INTO `code` VALUES (13,'haiohpd');
-INSERT INTO `code` VALUES (14,'daduwwg');
-INSERT INTO `code` VALUES (9,'7');
-INSERT INTO `code` VALUES (11,'9');
-/*!40000 ALTER TABLE `code` ENABLE KEYS */;
-UNLOCK TABLES;
-
-#
-# Source for table max
-#
-
-DROP TABLE IF EXISTS `max`;
-CREATE TABLE `max` (
- `pro` varchar(255) DEFAULT NULL,
- `max` int(11) NOT NULL
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
-#
-# Dumping data for table max
-#
-
-LOCK TABLES `max` WRITE;
-/*!40000 ALTER TABLE `max` DISABLE KEYS */;
-INSERT INTO `max` VALUES ('max',15);
-/*!40000 ALTER TABLE `max` ENABLE KEYS */;
-UNLOCK TABLES;
-
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
diff --git a/NKUCodingCat/0024/SQLIO.py b/NKUCodingCat/0024/SQLIO.py
deleted file mode 100644
index 910189d9..00000000
--- a/NKUCodingCat/0024/SQLIO.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#coding=utf-8
-import time, os, json, MySQLdb, HTMLParser, cgi
-def SQL_init():
- db = MySQLdb.connect("127.0.0.1","root","root","0024" )
- return db.cursor()
-def SQL_max(new=None):
- cursor = SQL_init()
- if new != None:
- sql="""UPDATE `max` SET `max`=%d WHERE `pro`='max'"""%new
- cursor.execute(sql)
- return True
- else:
- sql="""SELECT * FROM `max` WHERE `pro`='max'"""
- cursor.execute(sql)
- max = cursor.fetchall()[0][1]
- SQL_max(max+1)
- return max
-def SQL_in(task):
- max = SQL_max()
- cursor = SQL_init()
- sql = """INSERT INTO `code` SET `id`=%d,`to`='%s';"""%(max, task)
- cursor.execute(sql)
- return True
-def SQL_out():
- cursor = SQL_init()
- sql = """SELECT * FROM `code`"""
- cursor.execute(sql)
- return cursor.fetchall()
-def SQL_del(id):
- cursor = SQL_init()
- sql = """DELETE FROM `code` WHERE `id`=%d"""%id
- cursor.execute(sql)
- return json.dumps(cursor.fetchall())
-#-----------
-Temp = """
-
-
%s
-
-
-
-
-
-"""
-
-
-def PageMake():
- Data = SQL_out()
- All = ""
- Data = sorted(Data,key=lambda a:a[0] )
- for i in Data:
- #print i
- All+=Temp%(str(i[1]),int(i[0]))
- return All
\ No newline at end of file
diff --git a/NKUCodingCat/0024/main.py b/NKUCodingCat/0024/main.py
deleted file mode 100644
index ba03e834..00000000
--- a/NKUCodingCat/0024/main.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#coding=utf-8
-const = """
-
-
-
-
-
-
-
-
-
TodoList应用演示
-
-
-
-
-
-
-"""
-
-
-from bottle import static_file,route, run, post, request, redirect, error
-import os, urllib,re,json,time
-Root = os.path.split(os.path.realpath(__file__))[0]+"/static/"
-import SQLIO
-
-@route('/todo')
-def index():
- return const.format(SQLIO.PageMake(),)
-@post('/todo')
-def Accept():
- Req = request.body.read()
- L = re.split("&",Req)
- M = {}
- for i in L:
- A = re.split("=",i)
- M[A[0]] = urllib.unquote(A[1])
- for j in M.keys():
- if re.findall("id-",j):
- SQLIO.SQL_del(int(j[3:]))
- redirect('/todo', 302)
- try:
- type = M["new"]
- newtask = M["newtask"]
- except:
- redirect('/error', 404)
- if newtask != "":
- SQLIO.SQL_in(newtask)
- redirect('/todo', 302)
- else:
- return "=.=所以你想添加什么任务呀"
-
-@route('/error')
-def err():
- return "虽然不知道你在干什么但是触发了服务器错误呢"
-@route('/static/')
-def server_static(filename):
- return static_file(filename, root=Root)
-run(host='localhost',port=8080)
\ No newline at end of file
diff --git a/NKUCodingCat/0024/static/css.css b/NKUCodingCat/0024/static/css.css
deleted file mode 100644
index da2076eb..00000000
--- a/NKUCodingCat/0024/static/css.css
+++ /dev/null
@@ -1 +0,0 @@
-h1{color:green;}table,th,td{border:1px solid blue;}table{border-collapse:collapse;width:100%;}th{height:50px;}td.task{width:70%;}input#delete{font-size:15px;color:blue;background-color:#FFFFFF;border-width:0;cursor:pointer;}textarea{vertical-align:middle;width:500px;height:100px;}input#submit{width:107px;height:42px;border-width:0;font-size:17px;font-weight:500;border-radius:6px;cursor:pointer;}
\ No newline at end of file
diff --git a/NecoSama/README.md b/NecoSama/README.md
new file mode 100644
index 00000000..da4593c4
--- /dev/null
+++ b/NecoSama/README.md
@@ -0,0 +1,2 @@
+# My Repository
+My solution is shown as the url:
diff --git a/README.md b/README.md
index 7b884541..5d75dd92 100644
--- a/README.md
+++ b/README.md
@@ -8,20 +8,20 @@ Show Me the Code Python version.
### How to Add your solutions:
- * fork this repo
- * create a folder named with your github name
- * create a folder named the problem num
- * add your solution in the folder
+ * Fork this repo.
+ * Create a folder named with your github name.
+ * Create a folder named the problem num.
+ * Add your solution in the folder.
For example, if you wanna add a solution for problem 0001, you should do like this:
- * fork Show-Me-the-Code/python
- * git clone YOUR_REPO_URL SOME_DIR
- * cd SOME_DIR
- * mkdir YOUR_GITHUB_USER_NAME
- * cd YOU_GITHUB_USER_NAME
- * mkdir 0001
- * cd 0001
- * and the write some code & test it
+ * Fork `Show-Me-the-Code/python`.
+ * git clone `YOUR_REPO_URL SOME_DIR`.
+ * cd `SOME_DIR`.
+ * mkdir `YOUR_GITHUB_USER_NAME`.
+ * cd `YOU_GITHUB_USER_NAME`.
+ * mkdir `0001`.
+ * cd `0001`.
+ * and the write some code & test it.
-if all these steps done, send us an pull request. After we accepte your request, we'll invite you to this group.
+If all these steps done, send us an pull request. After we accept your request, we'll invite you to this group.
diff --git a/Tachone/README.md b/Tachone/README.md
new file mode 100644
index 00000000..e6b2512a
--- /dev/null
+++ b/Tachone/README.md
@@ -0,0 +1,8 @@
+View my codes through the url below
+
+https://github.com/Tachone/PythonCode
+
+otherwise,welcome to visit my csdn blog!
+It's about linux,c++,shell,python,network~~
+
+http://blog.csdn.net/nk_test
diff --git a/WangZhou/0000/consolab.ttf b/WangZhou/0000/consolab.ttf
new file mode 100644
index 00000000..55f6bd2f
Binary files /dev/null and b/WangZhou/0000/consolab.ttf differ
diff --git a/WangZhou/0000/insert_num_angle.py b/WangZhou/0000/insert_num_angle.py
new file mode 100644
index 00000000..73242822
--- /dev/null
+++ b/WangZhou/0000/insert_num_angle.py
@@ -0,0 +1,20 @@
+from PIL import Image, ImageDraw, ImageFont
+
+
+def insert_angle_num(img):
+ """
+ Insert a num on the right-upper angle,then save the new image.
+ :param img:string : filename of an Image object
+ """
+ with Image.open(img) as im:
+ width, height = im.size
+ draw_image = ImageDraw.Draw(im)
+ color = '#ff0000'
+ num_font = ImageFont.truetype('consolab.ttf', 100)
+ draw_image.text((width - 80, 20), '7', font=num_font, fill=color)
+ im.save('new_message.jpg')
+
+
+if __name__ == "__main__":
+ img = 'wz0000.jpg'
+ insert_angle_num(img)
diff --git a/WangZhou/0000/new_message.jpg b/WangZhou/0000/new_message.jpg
new file mode 100644
index 00000000..6f3bb4ef
Binary files /dev/null and b/WangZhou/0000/new_message.jpg differ
diff --git a/WangZhou/0000/wz0000.jpg b/WangZhou/0000/wz0000.jpg
new file mode 100644
index 00000000..d4a4d920
Binary files /dev/null and b/WangZhou/0000/wz0000.jpg differ
diff --git a/WangZhou/0001/gen_act_key.py b/WangZhou/0001/gen_act_key.py
new file mode 100644
index 00000000..45909b32
--- /dev/null
+++ b/WangZhou/0001/gen_act_key.py
@@ -0,0 +1,21 @@
+import uuid
+
+
+def gen_act_key(n):
+ """
+ 生成 n 个激活码,保存在字典。
+ :param n: int
+ :return: dict
+ """
+ act_code_store = {}
+
+ for i in range(n):
+ code0 = str(uuid.uuid1()).split('-')[0]
+ code1 = '-'.join(str(uuid.uuid3(uuid.NAMESPACE_DNS, f'{i}')).split('-')[1:])
+ act_code = code0 + '-' + code1
+ act_code_store[f'id-{i}'] = act_code
+ return act_code_store
+
+
+if __name__ == "__main__":
+ activity_code = gen_act_key(200)
diff --git a/Yixuan/0000/duck.jpg b/Yixuan/0000/duck.jpg
new file mode 100644
index 00000000..c74dbf60
Binary files /dev/null and b/Yixuan/0000/duck.jpg differ
diff --git a/Yixuan/0000/finnal.jpg b/Yixuan/0000/finnal.jpg
new file mode 100644
index 00000000..91af4c69
Binary files /dev/null and b/Yixuan/0000/finnal.jpg differ
diff --git a/Yixuan/0000/main.py b/Yixuan/0000/main.py
new file mode 100644
index 00000000..a27cf4b1
--- /dev/null
+++ b/Yixuan/0000/main.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+from PIL import Image, ImageDraw, ImageFont, ImageColor
+
+
+'''
+打开文件,
+声明 text 的位置, 是什么, 字体, 颜色.
+
+----
+'''
+
+original = Image.open("duck.jpg") #Open pic
+
+font = ImageFont.truetype("msyh.ttf", 60)
+
+d = ImageDraw.Draw(original)
+
+d.text((500, 0), "2", font=font, fill=(255,0,0,255))
+
+d = ImageDraw.Draw(original)
+
+original.save("finnal.jpg")
+
diff --git a/Yixuan/0000/msyh.ttf b/Yixuan/0000/msyh.ttf
new file mode 100644
index 00000000..aa23ae1f
Binary files /dev/null and b/Yixuan/0000/msyh.ttf differ
diff --git a/Yixuan/0001/code.md b/Yixuan/0001/code.md
new file mode 100644
index 00000000..161e02ca
--- /dev/null
+++ b/Yixuan/0001/code.md
@@ -0,0 +1,200 @@
+1. 3f654938-3b34-4585-b7f7-f41567b8e645
+2. b8e79c24-a7b4-4723-adae-96148557fb5f
+3. ce2de3c4-f479-47da-9bfe-84d54511597b
+4. 0d7ad4d4-a24c-46c5-b400-d5f13131c3a6
+5. ea97a605-feea-4806-8cab-9efc5009cb4f
+6. 44651cd4-3729-4fa3-8ef6-578c4aca17c5
+7. a6bdb701-6c63-4618-8183-03445f7341db
+8. 6b403e29-97ba-4d61-a1cc-b640b08b7184
+9. 656983b7-0f17-44b4-bfe1-b256bd313a4c
+10. ce587a68-a0a9-48b9-b575-69fcfd466f4f
+11. 151e5e37-3a62-48e7-a78b-7d0a580dd4d9
+12. 1ddaeba0-e342-4800-a324-dd48f837fae0
+13. 438b79e6-0944-448b-8116-5bcb1af00f87
+14. 4d59bff5-5049-4b81-b056-ea400f34d830
+15. ba70787c-c4b4-4f1f-84b8-bfd1c4cc0923
+16. d02a649a-acc9-46f8-8795-aadda041c9b0
+17. ee6127aa-c615-4bb6-8b58-6814b539a897
+18. 095477f1-920b-40bb-bf8b-5d63d4cc8562
+19. aa2fb5b6-7642-4427-963c-8866d09d5661
+20. b87c5852-c605-4753-8a68-ea3ceca4364c
+21. 2f880a72-82a2-4ed6-b139-269f1b9c613b
+22. bc40ada8-8553-4a6f-9d8c-30640f7448a1
+23. 37cbf172-73d2-4eaa-8d24-509146eca5cd
+24. 484ccf9b-a0cd-4c87-9445-b31d9bb7ddd8
+25. 3364723d-74ec-4df7-bfa5-8b19419f5ae9
+26. fdb3737b-d8f1-435b-b32d-25c11b170934
+27. e53991dd-50c5-45b9-974d-296716ddc0e0
+28. bf60b96b-2bc4-4043-b84a-78445116d6fb
+29. 2fe83f3e-16f3-4234-acfc-313887ff9620
+30. f27a9f6d-3daf-4172-9a45-975e870eef5b
+31. 7761b335-1884-45b4-a6a7-908b92122b3c
+32. 30166b2f-9e53-479f-beea-7002d67b3707
+33. 46fb8106-129b-4618-8d15-4fdd4be6f861
+34. 75b52f54-e50d-4542-9d91-dc1e80ae1a0f
+35. 26b23075-5b85-4720-a127-81dd1940e5d8
+36. ece5ed26-991c-4b3f-9309-9edbaabfe015
+37. c2eb57bd-b24d-423b-bb58-64aeb7b7c00b
+38. 53232e6c-5e39-47a9-bfc3-5b7652025d54
+39. fe8d95c7-2666-4217-b0c0-1aeaca2aecfd
+40. a1330a02-4ccf-408d-a46a-ed2170ec5e9e
+41. e27ff244-2f12-4749-b0bf-fab075bd4375
+42. ee96285b-6611-45a2-977e-743e68e9f84b
+43. 46b5294d-d6e3-401f-a6d1-67786bfac27e
+44. 64494b13-579b-45df-a3c9-55b4b0cb566c
+45. 3e10dda7-eb94-4652-9fb4-fd5202a53927
+46. 8f2fb84c-e8fb-4dbe-8428-7eb0c1f42647
+47. df66e698-0a0f-4541-a873-7fe456235d6f
+48. 18be0daf-7704-4a43-8758-ef3d5fe2e122
+49. a30daa16-3c9e-4022-9e16-392e3440b42b
+50. 703f2bfd-692b-487b-a8c2-0edfdb95f538
+51. 96e0eaa8-ad18-41f3-abb7-5f0239eeaf0d
+52. a2e00b48-5869-40b2-9712-0b1aae345f18
+53. d1c97db9-8402-44f1-b5a4-4d3183d469c4
+54. e552c679-5e3d-4000-8f1e-689ae23afe69
+55. 4db88579-5c7b-4339-a4b4-33cf870358bb
+56. da7ef6e2-d0b3-47db-9bfb-63391733b688
+57. a89536d8-9ebe-4741-a433-4c092183e598
+58. d2f9d5c0-3bd7-4b34-ab50-4794f3b7e733
+59. d42fa8f9-082c-4a79-ab3e-f8c67c88712a
+60. 0a2f6922-2860-4b5d-ac3b-390637839a38
+61. 02900b28-c774-4a4d-9497-1af77a14c5b9
+62. d520298b-d0ab-4c0e-b740-b08647a263fb
+63. 2f938524-d218-4215-a66a-bcf5d86665c2
+64. ad06ad28-6d69-4a57-81c7-2e4e28edd074
+65. 951f99f3-3c41-49c7-95d5-252e98c53c88
+66. 9b45f680-bf88-4afd-9db6-9c76c857b565
+67. 409adbc5-c62a-45e6-951c-7a43ac4c014f
+68. eda3935b-1900-46be-9158-91c2d617d16a
+69. b4830980-bae7-4151-931f-b6252d701605
+70. 63e29a47-7995-480e-aaaf-e288a7229656
+71. ec53de7b-38cd-4dab-acf6-3d3c951519ae
+72. 79fd2f79-7269-4a80-b62a-4b67e21371fe
+73. 74de0b9e-a660-42b9-aded-5e8cac9bc20b
+74. 8a6eaedc-116b-4ab3-a5b6-37ca7c970d0d
+75. bd4b77b8-dc32-411e-b0f2-2434d9dde74f
+76. 43d32480-955a-444c-9794-d6d53746ea83
+77. cd74e749-1e3d-406a-9ade-b88698cce346
+78. 1abc5745-2fc9-4244-8f2b-03c9bc2544ee
+79. dd59494e-2339-411b-8a69-6500d32e06e7
+80. 71fed090-15a4-42b2-8a24-56baa748172e
+81. 764a33d2-222a-45f6-ae20-f174b1a21548
+82. 28c2e491-4003-4b73-b570-c5d6eae7f247
+83. 64f36931-fd83-4001-af20-18c6112dc57e
+84. 4ec62f94-021f-4007-8475-70ebc880a187
+85. 1086e631-a654-4597-9c2b-47d14ddb04d2
+86. 5457bc3a-0595-4c2f-8cae-78a5cf75b0ab
+87. 026fb380-c1f2-4e71-a655-37db4a063640
+88. 0b44fa97-7019-48a8-9fb7-fa5a8baf1cd6
+89. c88c4ba8-8886-414a-875a-2fbcd87c1e15
+90. 880e5c6a-4b6b-4a0f-b7bd-0dde578ff4a0
+91. 905d527e-f54b-4b45-8d11-0e78ac8b6d1f
+92. 9477e52f-ab15-4f7a-8b3d-d06411051b8e
+93. 8ddc8db6-ecaa-4494-a4d7-1496aa9be92c
+94. 068e1a52-1002-4a66-ae90-07c7bbb80686
+95. 5ac1b226-0077-434c-81fc-ba5b59b843ed
+96. 0b13b926-dd01-4016-a5a6-115d154265eb
+97. be819d0a-8d7e-42a5-80f4-432f0ced0324
+98. f2dcd76b-8c4a-40af-a57b-77612594c207
+99. 11b7e07b-baa7-4114-b479-f7749dd1ac98
+100. ed3d4461-c291-4701-95b1-36fd6a4ece7f
+101. cc14d776-7461-48ba-818f-03510a8466f0
+102. 1dbe55f1-9877-4e18-8e76-36c7d1bbd239
+103. 25decf42-91d1-4ec4-9603-abfa9a5afa4c
+104. ea19ed4e-abfb-462b-ba90-a1294c4e53b7
+105. 4bfeadcc-95e7-439f-9f4f-046892382991
+106. 6a82b514-f7e9-4ea1-8f82-79d181a015f0
+107. e745de17-6139-4847-842c-008ba60acb0b
+108. c3ab3ff7-cd3f-4c83-8aa0-a033502b46e2
+109. a1b9ba37-5230-4956-a820-46a273c35bb8
+110. 52387327-01ee-4f4c-8a91-1833e0d19fa0
+111. d98edc3e-895e-4d01-a505-f94c1d6cf4e4
+112. ec72b2e1-93d2-43e4-b6d3-501b4a3e7654
+113. 7e2ad2bd-4421-4762-995b-d1941fe7e876
+114. dab25b3b-6cce-4ca2-91eb-2eb0e11b55b3
+115. ae16df43-402d-4765-9249-89fcbc5188a8
+116. 0a56c626-a169-4100-b932-3fdef9141079
+117. 25711d01-9228-4f9c-ae13-86f774c6e179
+118. dfb72410-9208-4e69-9252-1c8b56e2b052
+119. 571eaa38-4c6f-49cd-bb7d-cccd4b9e913e
+120. d8ba2cf4-1a32-40fd-8171-28fa53c1b269
+121. 749292ea-db2e-4db5-a952-18c0e71cdcaf
+122. b7a0a1d9-4032-40e7-8fe5-2219a04bb14b
+123. 9af40fa8-9e35-4fd4-b879-869e8da3b88d
+124. 8352d9ad-3e2e-4b67-aff2-65b8c046d82e
+125. 509e61d2-8b47-4c5d-8bd8-b3bc6d0eb8b0
+126. e415e315-b647-4e1b-bb14-aaff11923410
+127. 9ec998e4-d655-40a3-bedc-4291efa781da
+128. b3a3d295-a987-4442-9396-646909aaf2cc
+129. 0037ae45-5623-4c34-8482-4f2b0d0c1e65
+130. 4cc5ae3c-b317-43b8-bed4-8b0dd8c4bed0
+131. 5562ebf3-8df6-426a-8bcb-a7a25a57bcae
+132. feaa277c-6f8d-41c7-a3e6-00c76b9e6077
+133. 65e4a317-42c4-44a5-9c2a-b9261c2494ea
+134. 0799db74-2799-412b-9109-118933312560
+135. a91f601f-caab-4d7f-a874-f1ec883d90c2
+136. 017e1b31-e568-4f8a-8887-99b7b3743fbd
+137. 3301ab55-ae27-4713-ab25-f553e27a927d
+138. f3a9549e-6bea-4912-9d22-6e92f488544a
+139. e7d69120-5877-4212-bbd9-f4623f9fbe8d
+140. ccf2adcf-d816-41f9-8733-33d58b5f2a5a
+141. 1a579cb8-c2fd-4386-9676-de421c4837a4
+142. 43f026b9-e09c-4b4c-913b-e1e3d2e7c1cc
+143. b8737099-63a3-4771-b0c1-3ad57c195d37
+144. aae9711c-7ef2-45c5-89e8-8913518b0b36
+145. 1dbc21aa-64cd-4ce8-a150-9d1c1f986b51
+146. 449b9684-511f-4cd5-b610-51d9168ae8b1
+147. 89ca7227-4fab-483a-9682-fe0d619dd216
+148. 197b78b6-7a54-4a59-be80-2c84bb8811b3
+149. af95ddc9-3821-411d-8c6e-cd78785e7b56
+150. c600a1cc-9965-4bb1-8494-ef9d0f4abff5
+151. 694837db-f956-4772-a8ce-edfbfde6ff25
+152. ed6b74c2-2f43-42bb-ab4e-4be2957fbe1a
+153. a47381c8-3369-4830-bb9f-97643f8a1fa9
+154. 2733d133-0703-4648-9ef5-373a0beda5ac
+155. ad806245-df11-4bf2-89dc-195294083141
+156. 8492943f-de1c-4b34-b49c-2779ea5af3a7
+157. 2364d4d2-b9c0-4d0a-a9e5-c9b4e38c9e24
+158. 9889efba-a977-4d5b-9f3b-9a98f8e8e6e2
+159. 36ce676b-63a1-471f-b1ea-1e755ccc7631
+160. 977e26db-ed39-405a-b007-0c2b2bf43625
+161. 9ff654b7-3b09-43bf-97fc-2acd4d308aa1
+162. 1809a02d-3970-4951-bef3-acf7884a402c
+163. 25602879-7ad0-41f3-a8cb-635c2996ce4c
+164. adda3d47-377d-4a19-9d3e-abff09dc2c67
+165. 0c83fa5e-d271-4ebb-a438-840cb074c7a0
+166. c1f7ba6e-b22b-4850-ba21-ae231da31f6b
+167. 8568a74e-843b-45d0-9a30-582b8c8e9c59
+168. 6ffbeb12-8639-4d97-9988-a73360cddffc
+169. f3598b23-0741-499d-9bcd-ed1a1d3edae7
+170. 3b3492ff-b0a8-4341-943a-c44a6bb11f27
+171. 2701fec9-0693-4463-9599-befc09ce987a
+172. dc728f2f-c057-4f8f-b690-9646d69b6e41
+173. cb9569ab-d12e-4fc1-a905-0347868f0519
+174. 30fb9248-4cb8-4f51-add3-c7914ae34bfe
+175. 4a669209-cab6-4800-85aa-a6de510ed81c
+176. d5f81043-7cd9-4ab1-8247-40907be973bb
+177. 7b23f2a5-db14-4e25-81b9-4449f0c26b32
+178. 8768a814-e3e8-4396-a7e1-32440ec34c17
+179. 697e96ef-bcff-4097-8bbd-ee3a8beb5be7
+180. dc0ab926-196d-4d8b-8bed-0d842550c13b
+181. 53ea2b69-8c9a-4511-80ed-2142f1964d0a
+182. f38e6218-37e4-43af-85f5-a27acef5d8be
+183. cc19ab8d-a7af-446b-8d8a-1155b4b52851
+184. a6890790-ff42-402f-9352-792eea1a1f30
+185. 19124697-b4ba-4e67-b846-28c2f6cd2d09
+186. 57e9443a-7577-4e74-a32f-5ad71cccefe6
+187. 4899e4f1-a0b9-46f8-a09b-cf0420e88444
+188. 0f06b2f6-6fdf-4398-8071-d62d9520d3d3
+189. 50476641-9902-411a-b664-52d233e16040
+190. 2ea035c3-c362-44f3-9824-2dbbfcd32f41
+191. 77a582c6-046c-4a66-93fd-5315f0bca09f
+192. 3f1682d0-f6bc-4d0d-a335-d30ab3dc267b
+193. 14d6c743-69f1-4c5a-87c9-a666eb611f72
+194. fde1c6c1-905f-4785-829c-26925ad38d50
+195. fd17032e-c76a-476b-818b-0697f70cfd12
+196. 2ba10acf-ef65-4954-901d-485082c78259
+197. cf805a2d-030d-4fc0-a2a8-33c5096ac68e
+198. f7439f89-4b23-4f9d-b610-f5bfa276275c
+199. 0c1b58bc-2d78-4a3b-9cf5-f971da929379
+200. 96c4ae13-3927-4023-8c8f-9a77e9dd46a1
diff --git a/Yixuan/0001/code.py b/Yixuan/0001/code.py
new file mode 100644
index 00000000..a66f192b
--- /dev/null
+++ b/Yixuan/0001/code.py
@@ -0,0 +1,8 @@
+import uuid
+
+i = 1
+while (i < 201):
+ f = open('code.md', 'ar+')
+ s = str(i)+". "+str(uuid.uuid4())
+ f.write(s+"\n")
+ i +=1
diff --git a/Yixuan/0001/workfile b/Yixuan/0001/workfile
new file mode 100644
index 00000000..e69de29b
diff --git a/ZsnnsZ/README.md b/ZsnnsZ/README.md
new file mode 100644
index 00000000..5ab9e5dc
--- /dev/null
+++ b/ZsnnsZ/README.md
@@ -0,0 +1,2 @@
+提交项目地址,问题基本全部解决:
+https://github.com/ZsnnsZ/show-you-my-code
diff --git a/ailurus1991/0001/codes.txt b/ailurus1991/0001/codes.txt
index 26e98174..7198c7fa 100644
--- a/ailurus1991/0001/codes.txt
+++ b/ailurus1991/0001/codes.txt
@@ -1,200 +1,200 @@
-07ELiS3B
-wbEw2K7Z
-ODH0prGa
-iDwl7cF4
-uLd49jty
-5K4a2jR7
-bXay61gz
-dvCwV5Kw
-DKX80Jwa
-CpOJG3bC
-nmC6LNHo
-MCugndv8
-L3TBpc77
-yg2eGufG
-gKvUff78
-0UuiY9jI
-VdOmYNLp
-JWOvybaN
-rOpXsrG4
-pp9yA0UU
-XIt5aH8C
-irlE2V8O
-jp9gGCD4
-hynSrDcw
-nMRgkIbT
-gBZmLVXj
-L63Bl4pW
-Zuu7LJFP
-1cpIw01S
-8r3gS5un
-DeLn2nW8
-hGL3oXK3
-Oyg6XGGN
-IsmHK0a2
-cmYJgb7J
-brFmxKVN
-XpBYlhTj
-RDgPKSwb
-jDBaz5j9
-aw0PV8NA
-Yzfw7Gb9
-B1rX6lPN
-0bUfzfcz
-Gh39PGoa
-Akegbesg
-S2a0Mfod
-Lrba0c0W
-vBhG0OVZ
-gOenR9r9
-usg8Igst
-tTrTTTlP
-2uerutso
-UyK0YOCE
-LZJLon5J
-mcVmWTSM
-5YGpc1vj
-HE0zFaPs
-6oSHZKSi
-UmRzZLzD
-VvGEvWeX
-72MW1Yhe
-efu750PR
-uJ5cPLb2
-mvGNBCwn
-RYGyeu8R
-vgmhv3nA
-AbC3xS9h
-CGavT5ZH
-uClSx9fa
-se9tgUFg
-RZnGvK6c
-8ngxJ3t4
-it2l1cMl
-ASnRgmKG
-eaNxtwJJ
-GPr4DHfI
-TABgIdyY
-ppIhvBGl
-PJ2EOKOx
-LOeycE7Y
-WHc4hRos
-pLkzd8t0
-g1DJ3bzp
-1XiXun9T
-HeGBPWuB
-xnY8l1BW
-pp13sKHk
-o21x6nGC
-GfW5KCyb
-mSBtbyN6
-Upfn2YST
-FuBDk2aF
-TZYSzJFr
-cmKfTB0n
-fPOEUI55
-L8u7Fa9K
-e2dT5zeA
-CpxDKaha
-jR9dgGm1
-Rp5wzLGL
-gaKuxrbY
-C5zD0Ogn
-7sXTGOYt
-nmuLpxtY
-gF1fxkAc
-gZEM23es
-9CaF5ZhF
-ZG8BXNsh
-GJ0hJ1RY
-AbovgxFV
-gOiRytSP
-Xy6tydDZ
-rLZAZr2K
-GGgCLEzK
-EZXw6KHU
-12rA6HwD
-WdcmUpfh
-pTcL2AVZ
-iiTTEZAD
-9r09I993
-IA8m3afb
-mB3pACVP
-TcLMmxCg
-rOhdD9lN
-RTISe5UU
-0AsjKMsp
-gTP3UhLv
-DP6Vbtgg
-DkrE4l2Y
-zGvlNuTA
-BOCa0cd8
-tAG42DW8
-n6158oPG
-woZOFDwK
-RdZecnGR
-G9IgvSX5
-zE8oBorV
-UMZKLtLz
-EwnG1537
-HY1RsBSo
-rIzynYzG
-G6dTmRAs
-VjA5Rz3U
-XeRwvtO9
-g9z71OMw
-rxgeJwsx
-bzzRBuCu
-eOiJgvYI
-GYXJIG4a
-WN6mg6Iz
-SpxyjghJ
-uHmfhXwg
-O2WhHwSF
-g6zYyhZr
-6jYt7g19
-J5AUt36B
-sdGDCIa1
-3GvGIPGS
-HD5wlcTz
-Z96XKAyG
-gVX8uwEl
-E4IHGgGr
-bAbrc8pW
-TfUxLtDW
-T9lXGfhX
-C4nCjSZ4
-cauOES6a
-vBOe3Llc
-cHAvs2jv
-RAGxrePF
-WyndaKIi
-Eg7lGyrG
-GyeH2tcK
-9A1P6oiE
-wSoSkJvk
-8avTBzlB
-XUBFx6xs
-rRH2NNgf
-jy1nItmL
-p7NWxGwh
-zoF3aFNr
-LCivfna9
-tcdhOvP7
-alvHFgKL
-Dj39CPbx
-dGBM32CN
-XZXyvd45
-XFkRvZXh
-lTb1grNm
-dKi60bUk
-R1O7wKBI
-IpnIL3ug
-mOwaLEGc
-p859BYUr
-rOw3ndJY
-7npjvosA
-ZvjLNXG5
-kPc7Okua
-nal1g2uD
-8KLNVdCk
+067wDUmF
+WIE5ADSa
+yzbEbrkn
+78Cs0yUs
+7rC8ojTB
+x0n6Gifh
+A2ETYgl9
+gFlzZYrx
+4NzSt1sr
+bm3ASNIO
+THH2col6
+01zobZb5
+OgjiVfHL
+jJiTGlHw
+cDjk9aat
+ei37S20e
+v8MwU8Ay
+c2OPgHXJ
+Co7SCKaM
+FLY8JBWT
+uihcGKet
+FctyEKZp
+l7sMtgny
+MSR8gTta
+4GIYEeoB
+n0XDBftG
+2Hd9Y2ck
+KLdCGVLz
+GcCtm85C
+B19FPPGz
+X95nvyFg
+VgoM0O3l
+Cfl0dvad
+s5pu2Lsg
+x1C6IPsb
+U8gdNBbo
+aTD4nc3X
+TFhJ8hv9
+csxaFbsD
+HFhgchBw
+18enGW85
+Wn1uktzK
+4FTMiz84
+rzJxzZJJ
+EBXIC3bg
+SIkLuMcR
+AEhzICT2
+xMe5pgU8
+YjpyYLcI
+lOMJnFdO
+lMVdKj7J
+4nVrcNMk
+of8DU2Dc
+xSRGwsPC
+iGUDTU9V
+1CVcDt74
+V73OfYzr
+LYAb82H8
+NdWCKpej
+9jIoCTAJ
+wrAFhIMa
+szrKV5Vr
+LPpcsVxJ
+1eMWwAla
+ybleklKB
+m6ucvieP
+mHf6jewS
+bBCVMG1g
+3BdbbKvd
+fNpvWBlv
+17UGgPuS
+KFCgFzT8
+zdGiFgib
+8aH7vG2e
+KJsW1NAF
+EFOIyikg
+ErVISFhP
+e7G0HnOC
+LimUSRLY
+gowryZCr
+3ymxPGED
+Myfxo46p
+bDMorR79
+shbsx6uU
+st3hRGfJ
+WOpGTRDv
+cXsjlAnK
+G8pBYlE4
+twFZ8ZXC
+6uOlozge
+3rNG15ch
+ZmEnahs0
+8glVkUEa
+OLRGdj5o
+GjnpLexB
+CJxnG5i2
+GXUwUVWN
+yFKWRoVx
+vUbrT1uB
+pviEftiP
+4pDvYtwE
+m8nHJXGR
+BUvTcLz8
+TYC8z0YX
+81HDyXBf
+C5CTFNzf
+5GUxkZdL
+OL7gf8p0
+v7wbVSSW
+mLwXcTpj
+zMrh85gx
+i4gFLwYn
+ACOgocDu
+FgtJTamH
+0ytVTb9Y
+vldIGDwc
+fJ4t0TLR
+TRT0PNLm
+w5ZVDGwy
+RBYKUnVe
+6C74ns4U
+G5lwHP4C
+N8EEarnb
+ggHaNSrr
+UdciYEDP
+6dS1RHsD
+UGFY3sGI
+d5WN970r
+i8GZJ0KO
+4YJfF6O3
+EdafYI9V
+VPRfG4Rd
+x7ISwBwf
+YgJW38B3
+p6ZvBR4u
+HbBrzH3c
+1ob7y8FW
+tPo66Pnd
+nkHEnYCH
+inMyvaIt
+eAtO62GO
+KGtn0rAl
+Wln5Zs68
+UcsCS9MH
+aTxlR2Dn
+UIjBsbHx
+pEt3kSz3
+4yu66j4x
+4br5X0o6
+uBUFwunT
+ACsYgFmE
+BgdM6gHr
+ZtKEdLH6
+ZBMxBcg4
+Gb5Ws11z
+gVZ1GS5h
+8D3yar2p
+ySR3Bge8
+WS0e7gPM
+PfD9FsnN
+YG8Xhe4X
+yiglF48r
+iE9EgBIa
+gj8D5uaJ
+Goxl80Kj
+G1rucjuN
+n0R7vzMH
+k9aEGZnj
+4gGGOgi4
+1pWAS2v3
+GXYoICVX
+eG0KguCF
+3MFKfF7M
+84ByMUX1
+tM7eKnnr
+A9RyXkR4
+geFYr0MI
+CHtwhua8
+2VYgMTXh
+lmUSzUKF
+g5xDFFfW
+GzDoI1pG
+yw8Y1jGG
+DPzJHHFP
+ExC8epYJ
+Xgx1GhMb
+ulOvCnDc
+zKXlSSPn
+P2WyjuB1
+SHJPLPVA
+FyZhOPdU
+8ZXcojam
+AezONIMT
+DBc7slXt
+66B4DeTh
+3rltINms
+daXIFKhy
+v1g9xaHb
+ZWKlILmc
+YzGC1FVi
diff --git a/ailurus1991/0005/.DS_Store b/ailurus1991/0005/.DS_Store
deleted file mode 100644
index 08ecfc63..00000000
Binary files a/ailurus1991/0005/.DS_Store and /dev/null differ
diff --git a/ailurus1991/0005/pics/.DS_Store b/ailurus1991/0005/pics/.DS_Store
deleted file mode 100644
index 960740ed..00000000
Binary files a/ailurus1991/0005/pics/.DS_Store and /dev/null differ
diff --git a/ammmerzougui/0001/test.py b/ammmerzougui/0001/test.py
new file mode 100644
index 00000000..4c1c96f2
--- /dev/null
+++ b/ammmerzougui/0001/test.py
@@ -0,0 +1,11 @@
+'''
+Generating a random code
+By @ammmerzougui
+'''
+import random
+
+def genCode(length):
+ s = "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()?"
+ return "".join(random.sample(s,length))
+l=input("Enter the length of the random code: ")
+print(genCode(int(l)))
diff --git a/bbos1994/0001/discount.py b/bbos1994/0001/discount.py
new file mode 100644
index 00000000..8274da28
--- /dev/null
+++ b/bbos1994/0001/discount.py
@@ -0,0 +1,25 @@
+#! /usr/bin/python3
+# -*-coding:utf-8 -*-
+
+__author__ = 'TonyZhu'
+
+from random import randint
+
+str = 'abcdefghigklmnopqrstuvwxyz123456789'
+
+def produce(count):
+ discountNumArray = []
+ for _count in range(count):
+ discountNum = []
+ for i in range(10):
+ _index = randint(0,34)
+ discountNum.append(str[_index])
+ discountNumArray.append(''.join(discountNum))
+ return discountNumArray
+
+
+
+if __name__ == '__main__':
+ discountNumArray = produce(10)
+ for _array in discountNumArray:
+ print(_array)
\ No newline at end of file
diff --git a/bbos1994/0002/discount.py b/bbos1994/0002/discount.py
new file mode 100644
index 00000000..8274da28
--- /dev/null
+++ b/bbos1994/0002/discount.py
@@ -0,0 +1,25 @@
+#! /usr/bin/python3
+# -*-coding:utf-8 -*-
+
+__author__ = 'TonyZhu'
+
+from random import randint
+
+str = 'abcdefghigklmnopqrstuvwxyz123456789'
+
+def produce(count):
+ discountNumArray = []
+ for _count in range(count):
+ discountNum = []
+ for i in range(10):
+ _index = randint(0,34)
+ discountNum.append(str[_index])
+ discountNumArray.append(''.join(discountNum))
+ return discountNumArray
+
+
+
+if __name__ == '__main__':
+ discountNumArray = produce(10)
+ for _array in discountNumArray:
+ print(_array)
\ No newline at end of file
diff --git a/bbos1994/0002/saveDiscountToDB.py b/bbos1994/0002/saveDiscountToDB.py
new file mode 100644
index 00000000..fb898e1a
--- /dev/null
+++ b/bbos1994/0002/saveDiscountToDB.py
@@ -0,0 +1,23 @@
+#! /usr/bin/python3
+# -*- coding:utf-8 -*-
+
+__author__ = 'TonyZhu'
+
+import mysql.connector
+import discount
+
+def saveToMySQL(discount_str):
+ conn = mysql.connector.connect(user = 'root',password='password',database = 'Test')
+ cursor = conn.cursor()
+ cursor.execute('insert into discount values(%s)',[discount_str])
+ count = cursor.rowcount
+
+ conn.commit()
+ cursor.close()
+ return count
+
+if __name__ == '__main__':
+ discount_arr = discount.produce(3)
+ for _discount in discount_arr:
+ flag = True if saveToMySQL(_discount) == 1 else False
+ print(flag)
\ No newline at end of file
diff --git a/bbos1994/0004/countWord.py b/bbos1994/0004/countWord.py
new file mode 100644
index 00000000..9b93e133
--- /dev/null
+++ b/bbos1994/0004/countWord.py
@@ -0,0 +1,31 @@
+#! /usr/local/bin/python3
+# -*- coding:utf-8 -*-
+
+__author__='TonyZhu'
+
+import re
+# import os
+
+# print(os.getcwd()+'/words.txt')
+def wordStatistics(path):
+ wordDict = {}
+ with open(path,'r') as file:
+ for line in file:
+ wordsSplitByPunc = re.findall(r'[a-z0-9]+',line.lower())
+ for words in wordsSplitByPunc:
+ wordList = words.strip().split() # split by space
+ for _word in wordList:
+ if wordDict.has_key(_word):
+ wordCount = wordDict.get(_word)
+ wordCount+=1
+ wordDict[_word] = wordCount
+ else:
+ wordDict[_word] = 1
+ # wordListPerLine = line.lower().replace(string.punctuation,'').strip().split(' ')
+ return wordDict
+
+if __name__ == '__main__':
+ import os
+ wordDict = wordStatistics(os.getcwd()+'/word.txt')
+ for k,v in wordDict.items():
+ print('key is \'%s\',value is %s'%(k,v))
diff --git a/bbos1994/0004/word.txt b/bbos1994/0004/word.txt
new file mode 100644
index 00000000..07c117b2
--- /dev/null
+++ b/bbos1994/0004/word.txt
@@ -0,0 +1,2 @@
+l am the big big boy in the world;
+The world is big big include the boy ;
diff --git a/chris5641/0000/arial.ttf b/chris5641/0000/arial.ttf
new file mode 100644
index 00000000..ad7d8eab
Binary files /dev/null and b/chris5641/0000/arial.ttf differ
diff --git a/chris5641/0000/img.png b/chris5641/0000/img.png
new file mode 100644
index 00000000..589711ce
Binary files /dev/null and b/chris5641/0000/img.png differ
diff --git a/chris5641/0000/img.py b/chris5641/0000/img.py
new file mode 100644
index 00000000..42ef1ca0
--- /dev/null
+++ b/chris5641/0000/img.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+"""
+第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。
+"""
+from PIL import Image, ImageFont, ImageDraw
+
+__author__ = 'Chris5641'
+
+
+def img_add_num(num=1):
+ img = Image.open('img.png')
+ w, h = img.size
+ font = ImageFont.truetype('arial.ttf', w // 4)
+ draw = ImageDraw.Draw(img)
+ draw.text((w*3//4, 0), str(num), font=font, fill='red')
+ img.save('img2.png')
+
+
+if __name__ == '__main__':
+ img_add_num(5)
diff --git a/chris5641/0001/ActivationCode.txt b/chris5641/0001/ActivationCode.txt
new file mode 100644
index 00000000..c8e7cd2b
--- /dev/null
+++ b/chris5641/0001/ActivationCode.txt
@@ -0,0 +1,200 @@
+jasayyhci
+xx1ia7v1b
+zy546onps
+vetsatr2w
+x6f4y3468
+3g1pw108k
+wuyrji08q
+rzlzxs4xg
+bmir749bu
+v7inkwzoi
+68z0kq6ur
+pypmiu5og
+jidqni4fz
+c6b29b9kb
+r9znbbbmj
+331l6y08b
+m4nas4he4
+l4a42ypad
+xfc8h6wvo
+t4khbx7j1
+9hxvrrsah
+imbmie4ky
+e0actu2xz
+3u3amqtu0
+lcovbjpm3
+ds8zbk5jh
+o9y9s74ac
+jdldifamh
+nw15e3qf4
+w71kk7i6a
+iasy74ovn
+42v6hkfvp
+xtnwhy7mg
+id3z7ved4
+jr97n77ue
+3mjujcppy
+0tvfnt287
+llxys3ki8
+umldlkaxz
+8cc8tjlq7
+6y43a71ov
+2wbx19xmq
+3ypbwgy1h
+zazhe7d5r
+p5endwk3e
+wrczjq0cu
+41cuvr7z7
+u6dek96c9
+ek9cb76q3
+u7yybk8hv
+6fksdba4l
+9rehlyiua
+oh2mxkspj
+j32ik9hiu
+o4k7m9md3
+5slv1d2gd
+7gh1z7o0b
+1l82vu6nz
+jntsvp6hs
+k5pfdggxp
+zyo25p2qs
+joayw5bea
+0mm39197z
+0lha1urmm
+6m2k243cs
+zk80uvofv
+d9yzqmwf4
+j8klfjxhx
+uey550hc1
+xgvplru0h
+53ccnuxym
+5pg6a5zgj
+wljjnwwtq
+dg9eo40wk
+3xolm3tox
+7rvurzud3
+3ebemea0y
+9c7orc1qs
+pw6jn47yy
+pre1ixi35
+ph8et0vh0
+z2oh67j2b
+os2trzxuo
+h6njf1llw
+qm6q1erka
+345k0m9s9
+72xtf32fu
+zhrybh3ck
+wj7jx3oxi
+0rirzl6oe
+1d4a20r2g
+tnx7a3ekm
+o2xzp9hes
+fny6pazna
+scy17wh0h
+o3g4ptomq
+5w855mrna
+h9f1dryt4
+67b4z8hwk
+nsqicfb7k
+wurfj1qti
+ikn04uuza
+3d5n4jf2a
+79b0uji60
+pcf9exi5g
+tx90dwi6w
+u0qfcw2hb
+ds88iqnsw
+2ia1s623p
+1bcru8hig
+5sshn4khr
+9ivzpka1m
+n3vxc9j7v
+t6evn0x15
+xtb7ejk2x
+jzowhvmfn
+1a15ifimy
+16f5wk3wg
+8phllmc2g
+algx3osnk
+eejbrwtjf
+svjuctaix
+nmzhv1che
+9phravp6a
+pjo3236az
+zdtch5wvm
+olwpmadwq
+oosxw38lq
+ccf5ha2f6
+9u6tmxhsg
+8uwbf2jsj
+fxuevlu97
+pd1aeo1wn
+p731m62yt
+d84boj36g
+1z4t8492r
+ft2qi59n7
+d807oy13b
+ks2jzdn6l
+zdarbnlqw
+lq7o5ai9d
+k1sfr0g68
+tonfk9tz9
+ydii8sjta
+g9jn7bfb8
+h93ujq3te
+75lj46n1u
+kxcoj73gs
+370yg3fp2
+bjzq7a451
+db5ykml2w
+d2qflgw4k
+hes8v3asn
+ebt0ic9iy
+o4l215p31
+0a4kc2zld
+ez8bjzy5v
+3b1g5d8oi
+oobggx057
+p203tasho
+7u6j7m5qw
+stbnkwu33
+sgpf6xiyk
+6gd0v5rdt
+rd3ypbfb0
+mn3qtqtsg
+e2pu7kgne
+zup3mcpin
+ocvd586pd
+77ali7nip
+s4qv5kfz7
+xtr9fulx1
+sc2kcve4j
+l4jdugez4
+80s0mwdnz
+o57vts6gw
+unqar6rwq
+3xl01wlpi
+6uolx1fu2
+2x7cveh1t
+1qdhuzz8l
+b26tsrqyq
+ebbkqoj7d
+gaf1kxh2r
+y6sugvmhc
+7k3igekka
+pnnyrx5up
+9jeetttms
+ui6bdn6rj
+i0r72zw85
+6bylsgtzc
+s5su7plet
+c6ke4pl9g
+rbprh6m6l
+a8ew2e39q
+bpz51z3bz
+vyum7atru
+dcksu3tb1
+j0jyyczuq
+21va9yfqs
diff --git a/chris5641/0001/activation_code.py b/chris5641/0001/activation_code.py
new file mode 100644
index 00000000..8cb6c1ca
--- /dev/null
+++ b/chris5641/0001/activation_code.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+"""
+第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
+"""
+import random
+
+__author__ = 'Chris5641'
+
+
+def get_code():
+ f = open('ActivationCode.txt', 'w')
+ char_seq = 'abcdefghijklmnopqrstuvwxyz0123456789'
+ for i in range(200):
+ code = ''
+ for j in range(9):
+ code += random.choice(char_seq)
+ f.write(code+'\n')
+ f.close()
+
+
+if __name__ == '__main__':
+ get_code()
+
diff --git a/chris5641/0002/ActivationCode.txt b/chris5641/0002/ActivationCode.txt
new file mode 100644
index 00000000..c8e7cd2b
--- /dev/null
+++ b/chris5641/0002/ActivationCode.txt
@@ -0,0 +1,200 @@
+jasayyhci
+xx1ia7v1b
+zy546onps
+vetsatr2w
+x6f4y3468
+3g1pw108k
+wuyrji08q
+rzlzxs4xg
+bmir749bu
+v7inkwzoi
+68z0kq6ur
+pypmiu5og
+jidqni4fz
+c6b29b9kb
+r9znbbbmj
+331l6y08b
+m4nas4he4
+l4a42ypad
+xfc8h6wvo
+t4khbx7j1
+9hxvrrsah
+imbmie4ky
+e0actu2xz
+3u3amqtu0
+lcovbjpm3
+ds8zbk5jh
+o9y9s74ac
+jdldifamh
+nw15e3qf4
+w71kk7i6a
+iasy74ovn
+42v6hkfvp
+xtnwhy7mg
+id3z7ved4
+jr97n77ue
+3mjujcppy
+0tvfnt287
+llxys3ki8
+umldlkaxz
+8cc8tjlq7
+6y43a71ov
+2wbx19xmq
+3ypbwgy1h
+zazhe7d5r
+p5endwk3e
+wrczjq0cu
+41cuvr7z7
+u6dek96c9
+ek9cb76q3
+u7yybk8hv
+6fksdba4l
+9rehlyiua
+oh2mxkspj
+j32ik9hiu
+o4k7m9md3
+5slv1d2gd
+7gh1z7o0b
+1l82vu6nz
+jntsvp6hs
+k5pfdggxp
+zyo25p2qs
+joayw5bea
+0mm39197z
+0lha1urmm
+6m2k243cs
+zk80uvofv
+d9yzqmwf4
+j8klfjxhx
+uey550hc1
+xgvplru0h
+53ccnuxym
+5pg6a5zgj
+wljjnwwtq
+dg9eo40wk
+3xolm3tox
+7rvurzud3
+3ebemea0y
+9c7orc1qs
+pw6jn47yy
+pre1ixi35
+ph8et0vh0
+z2oh67j2b
+os2trzxuo
+h6njf1llw
+qm6q1erka
+345k0m9s9
+72xtf32fu
+zhrybh3ck
+wj7jx3oxi
+0rirzl6oe
+1d4a20r2g
+tnx7a3ekm
+o2xzp9hes
+fny6pazna
+scy17wh0h
+o3g4ptomq
+5w855mrna
+h9f1dryt4
+67b4z8hwk
+nsqicfb7k
+wurfj1qti
+ikn04uuza
+3d5n4jf2a
+79b0uji60
+pcf9exi5g
+tx90dwi6w
+u0qfcw2hb
+ds88iqnsw
+2ia1s623p
+1bcru8hig
+5sshn4khr
+9ivzpka1m
+n3vxc9j7v
+t6evn0x15
+xtb7ejk2x
+jzowhvmfn
+1a15ifimy
+16f5wk3wg
+8phllmc2g
+algx3osnk
+eejbrwtjf
+svjuctaix
+nmzhv1che
+9phravp6a
+pjo3236az
+zdtch5wvm
+olwpmadwq
+oosxw38lq
+ccf5ha2f6
+9u6tmxhsg
+8uwbf2jsj
+fxuevlu97
+pd1aeo1wn
+p731m62yt
+d84boj36g
+1z4t8492r
+ft2qi59n7
+d807oy13b
+ks2jzdn6l
+zdarbnlqw
+lq7o5ai9d
+k1sfr0g68
+tonfk9tz9
+ydii8sjta
+g9jn7bfb8
+h93ujq3te
+75lj46n1u
+kxcoj73gs
+370yg3fp2
+bjzq7a451
+db5ykml2w
+d2qflgw4k
+hes8v3asn
+ebt0ic9iy
+o4l215p31
+0a4kc2zld
+ez8bjzy5v
+3b1g5d8oi
+oobggx057
+p203tasho
+7u6j7m5qw
+stbnkwu33
+sgpf6xiyk
+6gd0v5rdt
+rd3ypbfb0
+mn3qtqtsg
+e2pu7kgne
+zup3mcpin
+ocvd586pd
+77ali7nip
+s4qv5kfz7
+xtr9fulx1
+sc2kcve4j
+l4jdugez4
+80s0mwdnz
+o57vts6gw
+unqar6rwq
+3xl01wlpi
+6uolx1fu2
+2x7cveh1t
+1qdhuzz8l
+b26tsrqyq
+ebbkqoj7d
+gaf1kxh2r
+y6sugvmhc
+7k3igekka
+pnnyrx5up
+9jeetttms
+ui6bdn6rj
+i0r72zw85
+6bylsgtzc
+s5su7plet
+c6ke4pl9g
+rbprh6m6l
+a8ew2e39q
+bpz51z3bz
+vyum7atru
+dcksu3tb1
+j0jyyczuq
+21va9yfqs
diff --git a/chris5641/0002/code2sql.py b/chris5641/0002/code2sql.py
new file mode 100644
index 00000000..4f81226b
--- /dev/null
+++ b/chris5641/0002/code2sql.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+"""
+第 0002 题:将 0001 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中。
+"""
+import pymysql
+__author__ = 'Chris5641'
+
+
+def code2sql():
+ f = open('ActivationCode.txt', 'r')
+ conn = pymysql.connect(user='root', passwd='password')
+ cursor = conn.cursor()
+ cursor.execute('create database if not exists accode')
+ cursor.execute('use accode')
+ cursor.execute('create table accode(id int auto_increment primary key, code varchar(10))')
+ for line in f.readlines():
+ cursor.execute('insert into accode (code) values (%s)', [line.strip()])
+ conn.commit()
+ f.close()
+ cursor.close()
+ conn.close()
+
+
+if __name__ == '__main__':
+ code2sql()
diff --git a/chris5641/0003/ActivationCode.txt b/chris5641/0003/ActivationCode.txt
new file mode 100644
index 00000000..c8e7cd2b
--- /dev/null
+++ b/chris5641/0003/ActivationCode.txt
@@ -0,0 +1,200 @@
+jasayyhci
+xx1ia7v1b
+zy546onps
+vetsatr2w
+x6f4y3468
+3g1pw108k
+wuyrji08q
+rzlzxs4xg
+bmir749bu
+v7inkwzoi
+68z0kq6ur
+pypmiu5og
+jidqni4fz
+c6b29b9kb
+r9znbbbmj
+331l6y08b
+m4nas4he4
+l4a42ypad
+xfc8h6wvo
+t4khbx7j1
+9hxvrrsah
+imbmie4ky
+e0actu2xz
+3u3amqtu0
+lcovbjpm3
+ds8zbk5jh
+o9y9s74ac
+jdldifamh
+nw15e3qf4
+w71kk7i6a
+iasy74ovn
+42v6hkfvp
+xtnwhy7mg
+id3z7ved4
+jr97n77ue
+3mjujcppy
+0tvfnt287
+llxys3ki8
+umldlkaxz
+8cc8tjlq7
+6y43a71ov
+2wbx19xmq
+3ypbwgy1h
+zazhe7d5r
+p5endwk3e
+wrczjq0cu
+41cuvr7z7
+u6dek96c9
+ek9cb76q3
+u7yybk8hv
+6fksdba4l
+9rehlyiua
+oh2mxkspj
+j32ik9hiu
+o4k7m9md3
+5slv1d2gd
+7gh1z7o0b
+1l82vu6nz
+jntsvp6hs
+k5pfdggxp
+zyo25p2qs
+joayw5bea
+0mm39197z
+0lha1urmm
+6m2k243cs
+zk80uvofv
+d9yzqmwf4
+j8klfjxhx
+uey550hc1
+xgvplru0h
+53ccnuxym
+5pg6a5zgj
+wljjnwwtq
+dg9eo40wk
+3xolm3tox
+7rvurzud3
+3ebemea0y
+9c7orc1qs
+pw6jn47yy
+pre1ixi35
+ph8et0vh0
+z2oh67j2b
+os2trzxuo
+h6njf1llw
+qm6q1erka
+345k0m9s9
+72xtf32fu
+zhrybh3ck
+wj7jx3oxi
+0rirzl6oe
+1d4a20r2g
+tnx7a3ekm
+o2xzp9hes
+fny6pazna
+scy17wh0h
+o3g4ptomq
+5w855mrna
+h9f1dryt4
+67b4z8hwk
+nsqicfb7k
+wurfj1qti
+ikn04uuza
+3d5n4jf2a
+79b0uji60
+pcf9exi5g
+tx90dwi6w
+u0qfcw2hb
+ds88iqnsw
+2ia1s623p
+1bcru8hig
+5sshn4khr
+9ivzpka1m
+n3vxc9j7v
+t6evn0x15
+xtb7ejk2x
+jzowhvmfn
+1a15ifimy
+16f5wk3wg
+8phllmc2g
+algx3osnk
+eejbrwtjf
+svjuctaix
+nmzhv1che
+9phravp6a
+pjo3236az
+zdtch5wvm
+olwpmadwq
+oosxw38lq
+ccf5ha2f6
+9u6tmxhsg
+8uwbf2jsj
+fxuevlu97
+pd1aeo1wn
+p731m62yt
+d84boj36g
+1z4t8492r
+ft2qi59n7
+d807oy13b
+ks2jzdn6l
+zdarbnlqw
+lq7o5ai9d
+k1sfr0g68
+tonfk9tz9
+ydii8sjta
+g9jn7bfb8
+h93ujq3te
+75lj46n1u
+kxcoj73gs
+370yg3fp2
+bjzq7a451
+db5ykml2w
+d2qflgw4k
+hes8v3asn
+ebt0ic9iy
+o4l215p31
+0a4kc2zld
+ez8bjzy5v
+3b1g5d8oi
+oobggx057
+p203tasho
+7u6j7m5qw
+stbnkwu33
+sgpf6xiyk
+6gd0v5rdt
+rd3ypbfb0
+mn3qtqtsg
+e2pu7kgne
+zup3mcpin
+ocvd586pd
+77ali7nip
+s4qv5kfz7
+xtr9fulx1
+sc2kcve4j
+l4jdugez4
+80s0mwdnz
+o57vts6gw
+unqar6rwq
+3xl01wlpi
+6uolx1fu2
+2x7cveh1t
+1qdhuzz8l
+b26tsrqyq
+ebbkqoj7d
+gaf1kxh2r
+y6sugvmhc
+7k3igekka
+pnnyrx5up
+9jeetttms
+ui6bdn6rj
+i0r72zw85
+6bylsgtzc
+s5su7plet
+c6ke4pl9g
+rbprh6m6l
+a8ew2e39q
+bpz51z3bz
+vyum7atru
+dcksu3tb1
+j0jyyczuq
+21va9yfqs
diff --git a/chris5641/0003/code2redis.py b/chris5641/0003/code2redis.py
new file mode 100644
index 00000000..1817bc4b
--- /dev/null
+++ b/chris5641/0003/code2redis.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+"""
+第 0003 题:将 0001 题生成的 200 个激活码(或者优惠券)保存到 Redis 非关系型数据库中。
+"""
+import redis
+__author__ = 'Chris5641'
+
+
+def code2redis():
+ i = 0
+ f = open('ActivationCode.txt', 'r')
+ r = redis.Redis(host='localhost', port=6379)
+ for line in f.readlines():
+ r.zadd('codes', line.strip(), i)
+ i += 1
+
+
+if __name__ == '__main__':
+ code2redis()
diff --git a/chris5641/0004/GetWordNum.py b/chris5641/0004/GetWordNum.py
new file mode 100644
index 00000000..dee7aee5
--- /dev/null
+++ b/chris5641/0004/GetWordNum.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+"""
+第 0004 题:任一个英文的纯文本文件,统计其中的单词出现的个数。
+"""
+import re
+__author__ = 'Chris5641'
+
+
+def get_num():
+ num = 0
+ f = open('test.txt', 'r')
+ for line in f.readlines():
+ num += len(re.findall(r'[a-zA-Z0-9\']+', line))
+ f.close()
+ return num
+
+
+if __name__ == '__main__':
+ print(get_num())
diff --git a/chris5641/0004/test.txt b/chris5641/0004/test.txt
new file mode 100644
index 00000000..d9695573
--- /dev/null
+++ b/chris5641/0004/test.txt
@@ -0,0 +1,3 @@
+Microsoft's is a big, computer compony.
+this is a test!
+
diff --git a/chris5641/0005/ChangeResolution.py b/chris5641/0005/ChangeResolution.py
new file mode 100644
index 00000000..5189a86a
--- /dev/null
+++ b/chris5641/0005/ChangeResolution.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+"""
+第 0005 题:你有一个目录,装了很多照片,把它们的尺寸变成都不大于 iPhone5 分辨率的大小。
+"""
+from PIL import Image
+import os
+
+__author__ = 'Chris5641'
+
+
+def change_resolution(path):
+ for picname in os.listdir(path):
+ picpath = os.path.join(path, picname)
+ with Image.open(picpath) as im:
+ w, h = im.size
+ n = w/1366 if (w/1366) >= (h/640) else h/640
+ im.thumbnail((w/n, h/n))
+ im.save('finish_'+picname.split('.')[0]+'.jpg', 'jpeg')
+
+
+if __name__ == '__main__':
+ change_resolution('/home/chris/pictures/123')
diff --git a/cnwangjie b/cnwangjie
new file mode 160000
index 00000000..98664848
--- /dev/null
+++ b/cnwangjie
@@ -0,0 +1 @@
+Subproject commit 986648481f91753fe53fc8457df9a30cdfb7c395
diff --git a/crazyacking/0000/add_num.py b/crazyacking/0000/add_num.py
new file mode 100644
index 00000000..4361c9fc
--- /dev/null
+++ b/crazyacking/0000/add_num.py
@@ -0,0 +1,33 @@
+#!/usr /bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+将你的 QQ 头像右上角加上红色的数字,类似于微信未读信息数量提示效果
+Pillow:Python Imaging Library
+PIL.ImageDraw.Draw.text(xy, text, fill=None, font=None, anchor=None)
+"""
+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 setFont(self,font_path,size):
+ self.fnt=ImageFont.truetype(font_path,size)
+ return True
+ def draw_text(self,position,str,colour,fnSSt):
+ draw=ImageDraw.Draw(self.im)
+ draw.text(position,str,fill=colour,font=fnt)
+ self.im.show()
+ self.im.save(str+'num'+'.jpg')
+ return True
+
+
+test=Image_unread_message()
+test.open('test.jpg')
+test.setFont('ahronbd.ttf',80)
+test.draw_text((160,-20),'4',(255,0,0),test.fnt)
\ No newline at end of file
diff --git a/crazyacking/0000/ahronbd.ttf b/crazyacking/0000/ahronbd.ttf
new file mode 100644
index 00000000..a0bd1911
Binary files /dev/null and b/crazyacking/0000/ahronbd.ttf differ
diff --git a/crazyacking/0000/simsunb.ttf b/crazyacking/0000/simsunb.ttf
new file mode 100644
index 00000000..36ad1220
Binary files /dev/null and b/crazyacking/0000/simsunb.ttf differ
diff --git a/crazyacking/0001/0001.py b/crazyacking/0001/0001.py
new file mode 100644
index 00000000..0926d226
--- /dev/null
+++ b/crazyacking/0001/0001.py
@@ -0,0 +1,7 @@
+import uuid
+"""
+做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用**生成激活码**(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
+"""
+
+for i in range(200):
+ print(str(uuid.uuid4()))
\ No newline at end of file
diff --git a/crazyacking/0002/0002.py b/crazyacking/0002/0002.py
new file mode 100644
index 00000000..89749a0d
--- /dev/null
+++ b/crazyacking/0002/0002.py
@@ -0,0 +1,88 @@
+#coding=utf-8
+
+import uuid
+
+import MySQLdb
+
+"""
+002, 将 0001 题生成的 200 个激活码(或者优惠券)保存到 **MySQL** 关系型数据库中
+"""
+
+
+class ActivationCode(object):
+ def __init__(self, code_count, database, username, host='localhost', port=3306, password=''):
+ self._host = host
+ self._username = username
+ self._password = password
+ self._database = database
+ self._port = port
+
+ self.codes = self._generate_activation_code(code_count)
+ #print self.codes
+
+
+ def _get_mysql_instance(self):
+ params = {
+ 'host': self._host,
+ 'user': self._username,
+ 'passwd': self._password,
+ 'db': self._database,
+ 'port': self._port,
+ }
+ return MySQLdb.connect(**params)
+
+
+ def _generate_activation_code(self, count):
+ code_list = []
+ for i in xrange(count):
+ code = str(uuid.uuid4()).replace('-', '').upper()
+ if not code in code_list:
+ code_list.append(code)
+
+ return code_list
+
+
+ def store_to_mysql(self):
+ if self.codes:
+ conn = self._get_mysql_instance()
+
+ try:
+ cur = conn.cursor()
+
+ # clear old datas
+ cur.execute('delete from code')
+
+ # insert mutilple code
+ for code in self.codes:
+ cur.execute("insert into code(code) values('%s')" % code)
+
+ conn.commit()
+ cur.close()
+ conn.close()
+
+ return True
+ except MySQLdb.Error,e:
+ conn.rollback()
+ print "Mysql Error %d: %s" % (e.args[0], e.args[1])
+
+ return False
+
+
+ def print_activation_code(self):
+ conn = self._get_mysql_instance()
+
+ try:
+ cur = conn.cursor()
+ cur.execute('select code from code')
+
+ results = cur.fetchall()
+ for row in results:
+ print row[0]
+ except MySQLdb.Error,e:
+ print "Mysql Error %d: %s" % (e.args[0], e.args[1])
+
+
+if __name__ == "__main__":
+ active_code = ActivationCode(200, database='Test', username='root')
+ if active_code.store_to_mysql():
+ active_code.print_activation_code()
diff --git a/crazyacking/0003/Activation_code.txt b/crazyacking/0003/Activation_code.txt
new file mode 100644
index 00000000..2174d5e9
--- /dev/null
+++ b/crazyacking/0003/Activation_code.txt
@@ -0,0 +1,200 @@
+xsdPh4f
+8qoW07j
+Tnj1HmB
+zIT8qAB
+FnDnNi0
+3QpZj1O
+KlkwRfE
+wsdy8NQ
+pvXSdlY
+pp9LWSn
+dS6zQnC
+WbCHjJH
+jAjJtli
+38ykU8k
+wMNCQ1m
+X245rLW
+UWizZgo
+YkLduIF
+v1GJSdz
+BNMZuX5
+yIjRDQu
+GNvXIIF
+DbWEtTD
+F1W2jtg
+54bWrUb
+b2IEbzZ
+xcaOsuG
+uXOhegJ
+TvKkKSN
+KgSCoEJ
+elrc80r
+DOXohsE
+KjdnEGw
+ffqwUwX
+xdRhBkT
+ruceTaI
+RZZTs0h
+K5EKaNj
+VqW5vfD
+ownScnm
+7rGnRPw
+TiaUfFy
+7YSMWr0
+C9YkCdo
+6ikBwSy
+qiETLg6
+aKDPWxE
+b3cCXhY
+MKA2OKu
+9EdcKmD
+0qeKaui
+ejpFFlC
+SmC9Nor
+mCPyWEv
+kStIHKd
+9DkalxT
+jWColwT
+GcTkSXk
+V5UrDSg
+ekrLbCf
+cQXARzF
+UP7ksMd
+MGVEVVH
+tKlLsKA
+bz978B2
+3d6BchN
+FQaaOIJ
+CVOzpVy
+5S41CmW
+BrEcQpZ
+RgpvtTu
+eNIFEtp
+IYA1GXy
+aVofZsk
+RtR05Dr
+RtKSB4v
+ylWhH4I
+E1rTSQQ
+km1GyrM
+1YhC46I
+Yth5Mop
+h1rq8Zt
+1N33N7j
+k5BXCmg
+E1wPDwt
+uvWFfTk
+QaExb9R
+xmbbV3I
+Jiqxv4q
+t86xdCq
+hjnITkf
+X7QfU9R
+BNrvD6R
+TrD8RKS
+j4Hb5m0
+Ej01pN1
+DjBieTP
+TF1Yhw3
+P8Hvl0h
+iuQIBSZ
+7hYH1nu
+Keddid3
+UMhZAlX
+yEBxCNV
+h9eUhig
+Uf2FGRg
+D6mGp0Y
+slkzCJF
+d2MtwFg
+H4P7dA5
+dh3uvgk
+hV67DzW
+kS6veXF
+QWs0IBe
+mUTAsKo
+bA3ZmDA
+bdzo5aa
+ssP0Ioy
+bSzxPwX
+Yvx2TwW
+B8RHjhI
+f1k9PHy
+JT6UjuI
+UrUzUMT
+gatlmvG
+Z0IcjOW
+WSeJD71
+xn2TEqq
+l6XMop0
+cebTTJx
+JAFSQP7
+hP86mW8
+uTbUfPI
+uInfJSv
+PkWbVsD
+Soc04tS
+Trv2Tli
+p9OQOR6
+2E63ef8
+mOIm6vn
+pvY48CT
+18u0DeJ
+G65JpBW
+fXAyrcL
+nujVYv3
+Zmcu79i
+NPtWjMc
+Xhsc44i
+cpVKhfM
+QiwFFGB
+YbBpW33
+ShzJeoe
+rRVzaA2
+9P9TjOA
+9DCcFW6
+eV9kso8
+ylNtW8l
+cg4NDrW
+z9jG8LY
+p8DRxic
+v60BL2p
+7gXCYhl
+bRFKTnV
+9hAeREO
+UF8Ushb
+zHnAsxJ
+qIEgxWg
+B2gMwr8
+fyTx67J
+14iRytg
+hLludCg
+jMVkbU1
+lFQQ1YX
+stOGahb
+cgB8aJC
+eVyrvc7
+eftb4Ge
+MFyiWOO
+hAf6Hha
+b884B8F
+qXaVpDs
+z1PYqm3
+YXZz3YI
+LZgQpdZ
+HpYkmdw
+uhR1wth
+mwfz0kk
+9AlVldl
+pQ8xzhi
+5tPou1g
+ahNqlgN
+euCV2IH
+tg9b7s8
+Z4r2aA6
+JYUijB2
+k6tMe54
+LJuhb7x
+Z6VPjwe
+U3qgd0G
+a9RH5fF
diff --git a/crazyacking/0003/store_redis.py b/crazyacking/0003/store_redis.py
new file mode 100644
index 00000000..d286d380
--- /dev/null
+++ b/crazyacking/0003/store_redis.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+
+import redis
+
+def store_redis(filepath):
+ r = redis.StrictRedis(host = 'localhost', port = 6379, db = 0)
+ f = open(filepath, 'rb')
+ for line in f.readlines():
+ code = line.strip()
+ r.lpush('code', code)
+
+if __name__ == '__main__':
+ store_redis('Activation_code.txt')
diff --git a/crazyacking/0005/changeResolution.py b/crazyacking/0005/changeResolution.py
new file mode 100644
index 00000000..cb67a271
--- /dev/null
+++ b/crazyacking/0005/changeResolution.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+'''
+第 0005 题:你有一个目录,装了很多照片,把它们的尺寸变成都不大于 iPhone5 分辨率的大小
+'''
+from PIL import Image
+
+def change_img(path,size=(1136,640)):
+ im = Image.open(path)
+ size=(size[1],size[0]) if im.size[1]>im.size[0] else size
+ im.thumbnail(size,Image.ANTIALIAS) #Image.ANTIALIAS为滤镜参数
+ im.save('result-'+path)
+
+change_img('1.jpg')
diff --git a/deng47/problem 0000/solution for problem 0000.py b/deng47/problem 0000/solution for problem 0000.py
new file mode 100644
index 00000000..e613f3f5
--- /dev/null
+++ b/deng47/problem 0000/solution for problem 0000.py
@@ -0,0 +1,13 @@
+from PIL import Image, ImageDraw, ImageFont
+
+def add_num(img):
+ draw = ImageDraw.Draw(img)
+ myfont = ImageFont.truetype('C:/windows/fonts/Calibri.ttf', size=90)
+ fillcolor = "#ff0000"
+ width, height = img.size
+ draw.text((width-90, 10), '4', font=myfont, fill=fillcolor)
+ img.save('result.jpg','jpeg')
+
+if __name__ == '__main__':
+ image = Image.open('test.jpg')
+ add_num(image)
\ No newline at end of file
diff --git a/doubi_sdust/0000.py b/doubi_sdust/0000.py
new file mode 100644
index 00000000..dcc25f32
--- /dev/null
+++ b/doubi_sdust/0000.py
@@ -0,0 +1,20 @@
+'''
+
+第 0000 题: 将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。 类似于图中效果
+
+'''
+from PIL import Image, ImageDraw, ImageFont
+#PIL https://pillow.readthedocs.org/
+def add_num(img):
+ draw = ImageDraw.Draw(img)
+ #加载TrueType或OpenType字体文件,并创建一个字体对象。
+ myfont = ImageFont.truetype('C:/windows/fonts/Arial.ttf', size=20)
+ fillcolor = "#ff0000"
+ width, height = img.size
+ draw.text((width-40, 0), '2', font=myfont, fill=fillcolor)
+ img.save('result.jpg','jpeg')
+ return 0
+
+image = Image.open('image.jpg')
+print(image.format,image.size,image.mode)
+add_num(image)
\ No newline at end of file
diff --git a/doubi_sdust/0001.py b/doubi_sdust/0001.py
new file mode 100644
index 00000000..7f36876d
--- /dev/null
+++ b/doubi_sdust/0001.py
@@ -0,0 +1,35 @@
+'''
+第 0001 题: 做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
+
+将 0001 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中。
+'''
+import random
+import pymysql
+def creat_num(num,long):
+ str = 'qwertyuiopasdfghjklzxcvbnm1234567890'
+ b = []
+ for i in range(num):
+ a = ''
+ for j in range(long):
+ a += random.choice(str)
+ b.append(a)
+ return b
+
+def InsertIntoMysql(codelist):
+ # 打开数据库连接
+ db = pymysql.connect(host='127.0.0.1',user='root',passwd='919824467',db='mysql')
+ # 使用 cursor() 方法创建一个游标对象 cursor
+ cur = db.cursor()
+ #数据库语句
+ cur.execute('CREATE DATABASE IF NOT EXISTS code')
+ cur.execute('USE code')
+ cur.execute('''CREATE TABLE IF NOT EXISTS num(
+ id INT NOT NULL AUTO_INCREMENT,
+ code VARCHAR(32) NOT NULL,
+ PRIMARY KEY(id) )''')
+ for num in codelist:
+ cur.execute('INSERT INTO num(code) VALUES(%s)',(num))
+ cur.connection.commit()
+ db.close()
+
+InsertIntoMysql(creat_num(200,10))
\ No newline at end of file
diff --git a/doubi_sdust/0002.py b/doubi_sdust/0002.py
new file mode 100644
index 00000000..28b8b1b8
--- /dev/null
+++ b/doubi_sdust/0002.py
@@ -0,0 +1 @@
+#refer to 0001.py
\ No newline at end of file
diff --git a/doubi_sdust/0003.py b/doubi_sdust/0003.py
new file mode 100644
index 00000000..e69de29b
diff --git a/doubi_sdust/0004.py b/doubi_sdust/0004.py
new file mode 100644
index 00000000..eb433587
--- /dev/null
+++ b/doubi_sdust/0004.py
@@ -0,0 +1,14 @@
+'''
+第 0004 题: 任一个英文的纯文本文件,统计其中的单词出现的个数。
+'''
+
+# encoding: utf-8
+import collections
+import os
+
+with open('test.txt','r') as fp:
+ str1=fp.read().split(' ')
+b = collections.Counter(str1)
+with open('result.txt','w') as result_file:
+ for key,value in b.items():
+ result_file.write(key+':'+str(value)+'\n')
\ No newline at end of file
diff --git a/doubi_sdust/0005.py b/doubi_sdust/0005.py
new file mode 100644
index 00000000..00d842aa
--- /dev/null
+++ b/doubi_sdust/0005.py
@@ -0,0 +1,15 @@
+'''
+第 0005 题: 你有一个目录,装了很多照片,把它们的尺寸变成都不大于 iPhone5 分辨率的大小。
+'''
+from PIL import Image
+import os.path
+
+def Size(dirPath, size_x, size_y):
+ f_list = os.listdir(dirPath)
+ for i in f_list:
+ if os.path.splitext(i)[1] == '.jpg':
+ img = Image.open(i)
+ img.thumbnail((size_x,size_y))
+ img.save(i)
+ print(i)
+Size('D:\PyCharm 2017.1.3\projects', 1136, 640)
\ No newline at end of file
diff --git a/doubi_sdust/0006.py b/doubi_sdust/0006.py
new file mode 100644
index 00000000..9f573b36
--- /dev/null
+++ b/doubi_sdust/0006.py
@@ -0,0 +1,24 @@
+'''
+第 0006 题: 你有一个目录,放了你一个月的日记,都是 txt,为了避免分词的问题,假设内容都是英文,请统计出你认为每篇日记最重要的词。
+'''
+# encoding: utf-8
+import collections
+import os.path
+def judgeit(words):
+ for i in range(6):
+ if len(words[i]) > 2 and words[i] != 'the' and words[i] != 'her' and words[i] != 'his' and words[i] != 'and' and words[i] != 'she':
+ return words[i]
+ return words[7]
+
+def mainKeywords(dirPath):
+ f_list = os.listdir(dirPath)
+ for i in f_list:
+ if os.path.splitext(i)[1] == '.txt':
+ print('the keywords of' + i + ' is:' )
+ with open(i, 'r') as fp:
+ str1 = fp.read().split(' ')
+ b = collections.Counter(str1)
+ keywords = sorted(b, key=lambda x: b[x],reverse = True)
+ print(judgeit(keywords))
+
+mainKeywords('D:\PyCharm 2017.1.3\projects')
\ No newline at end of file
diff --git a/doubi_sdust/0007.py b/doubi_sdust/0007.py
new file mode 100644
index 00000000..50a8f56b
--- /dev/null
+++ b/doubi_sdust/0007.py
@@ -0,0 +1,39 @@
+'''
+第 0007 题: 有个目录,里面是你自己写过的程序,统计一下你写过多少行代码。包括空行和注释,但是要分别列出来。
+'''
+import os.path
+import re
+def mainKeywords(dirPath):
+ blank, comments, codelines, totalines, count, temp = 0, 0, 0, 0, 0, 0
+ f_list = os.listdir(dirPath)
+ for i in f_list:
+ if os.path.splitext(i)[1] == '.py':
+ print(i)
+ with open(i, 'r', encoding='utf-8') as fp:
+ while True:
+ line = fp.readline()
+ totalines += 1
+ if not line:
+ break
+ elif line.strip().startswith('#'):
+ comments += 1
+ elif line.strip().startswith("'''") or line.strip().startswith('"""'):
+ comments += 1
+ if line.count('"""') == 1 or line.count("'''") == 1:
+ while True:
+ line = fp.readline()
+ totalines += 1
+ comments += 1
+ if ("'''" in line) or ('"""' in line):
+ break
+ elif line.strip():
+ codelines += 1
+ else:
+ blank += 1
+ print('the nuber of totalines is : ' + str(totalines-1))
+ print('the nuber of comments is : ' + str(comments))
+ print('the nuber of codelines is : ' + str(codelines))
+ print('the nuber of blanklines is : ' + str(blank))
+ blank, comments, codelines, totalines = 0, 0, 0, 0
+
+mainKeywords('D:\PyCharm 2017.1.3\projects')
\ No newline at end of file
diff --git a/doubi_sdust/0008.py b/doubi_sdust/0008.py
new file mode 100644
index 00000000..0821a8e0
--- /dev/null
+++ b/doubi_sdust/0008.py
@@ -0,0 +1,19 @@
+'''
+第 0008 题: 一个HTML文件,找出里面的正文。
+
+第 0009 题: 一个HTML文件,找出里面的链接。
+'''
+
+# coding=utf-8
+from bs4 import BeautifulSoup
+def sechBodyUrl(path):
+ with open(path,encoding='utf-8') as fp:
+ text = BeautifulSoup(fp, 'lxml')
+ urls = text.findAll('a')
+ for u in urls:
+ print(u['href'])
+ content = text.get_text().strip('\n')
+ return content
+
+sechBodyUrl('0007.html')
+#print(searchBody('0007.html'))
\ No newline at end of file
diff --git a/doubi_sdust/0009.py b/doubi_sdust/0009.py
new file mode 100644
index 00000000..be2e68ee
--- /dev/null
+++ b/doubi_sdust/0009.py
@@ -0,0 +1 @@
+#refer to 0008.py
\ No newline at end of file
diff --git a/doubi_sdust/0010.py b/doubi_sdust/0010.py
new file mode 100644
index 00000000..e7e8dea8
--- /dev/null
+++ b/doubi_sdust/0010.py
@@ -0,0 +1,37 @@
+'''
+第 0010 题: 使用 Python 生成类似于下图中的字母验证码图片
+
+参考廖雪峰代码:liaoxuefeng.com/…/00140767171357714f87a053a824ffd811d98a83b58ec13000
+'''
+from PIL import Image, ImageDraw, ImageFont, ImageFilter
+import random
+
+# 随机字母:
+def rndChar():
+ return chr(random.randint(65, 90))
+# 随机颜色1:
+def rndColor():
+ return (random.randint(64, 255), random.randint(64, 255), random.randint(64, 255))
+# 随机颜色2:
+def rndColor2():
+ return (random.randint(32, 127), random.randint(32, 127), random.randint(32, 127))
+
+# 240 x 60:
+width = 240
+height = 60
+image = Image.new('RGB', (width, height), (255, 255, 255))
+# 创建Font对象:
+font = ImageFont.truetype('C:/windows/fonts/Arial.ttf', 36)
+# 创建Draw对象:
+draw = ImageDraw.Draw(image)
+# 填充每个像素:
+for x in range(width):
+ for y in range(height):
+ draw.point((x, y), fill=rndColor())
+# 输出文字:
+for t in range(4):
+ draw.text((60 * t + 10, 10), rndChar(), font=font, fill=rndColor2())
+# 模糊:
+image = image.filter(ImageFilter.BLUR)
+image.save('code.jpg', 'jpeg');
+image.show('code.jpg')
\ No newline at end of file
diff --git a/effy/0000/.DS_Store b/effy/0000/.DS_Store
deleted file mode 100644
index 5008ddfc..00000000
Binary files a/effy/0000/.DS_Store and /dev/null differ
diff --git a/evan69/0000/0000.py b/evan69/0000/0000.py
new file mode 100644
index 00000000..40d9d90d
--- /dev/null
+++ b/evan69/0000/0000.py
@@ -0,0 +1,23 @@
+# coding=utf-8
+from PIL import Image,ImageFont,ImageDraw
+import sys
+def add_number(filename,number):
+ mystr = str(min(99,number))
+ al = 0.4
+ if number > 99:
+ mystr += '+'
+ al = 0.25
+ print mystr
+ img = Image.open(filename)
+ fontsize = min(img.size[0],img.size[1])
+ print img.size
+ fontsize = int(fontsize * al)
+ font = ImageFont.truetype('Arial.ttf',size = fontsize)
+ position = img.size[0] - font.getsize(mystr)[0]
+ dr = ImageDraw.Draw(img)
+ dr.text((position,0),mystr,font = font,fill = (255,0,0,255))
+ return img
+
+filename = sys.argv[1]
+num = sys.argv[2]
+add_number(filename,int(num)).save(num + '_' + filename)
diff --git a/evan69/0000/1.jpg b/evan69/0000/1.jpg
new file mode 100644
index 00000000..436f58aa
Binary files /dev/null and b/evan69/0000/1.jpg differ
diff --git a/evan69/0000/2.png b/evan69/0000/2.png
new file mode 100644
index 00000000..84a947cf
Binary files /dev/null and b/evan69/0000/2.png differ
diff --git a/evan69/0000/Arial.ttf b/evan69/0000/Arial.ttf
new file mode 100644
index 00000000..12cc15c8
Binary files /dev/null and b/evan69/0000/Arial.ttf differ
diff --git a/evan69/0001/0001.py b/evan69/0001/0001.py
new file mode 100644
index 00000000..978a04dd
--- /dev/null
+++ b/evan69/0001/0001.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# 做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
+
+import uuid
+
+def produce_str(num = 200):
+ str_list = []
+ i = 0
+ while True:
+ i = i + 1
+ if i > num:
+ break
+ mystr = str(uuid.uuid1()).replace('-','')
+ if mystr not in str_list:
+ str_list.append(mystr)
+ return str_list
+
+
+a = produce_str()
+print a
diff --git a/evan69/0004/0004.py b/evan69/0004/0004.py
new file mode 100644
index 00000000..437e804a
--- /dev/null
+++ b/evan69/0004/0004.py
@@ -0,0 +1,18 @@
+import collections,re
+import sys
+def cal(filename = 'in.txt'):
+ print 'now processing:' + filename + '......'
+ f = open(filename,'r')
+ data = f.read()
+ dic = collections.defaultdict(lambda :0)
+ data = re.sub(r'[\W\d]',' ',data)
+ data = data.lower()
+ datalist = data.split(' ')
+ for item in datalist:
+ dic[item] += 1
+ del dic['']
+ return dic
+try:
+ print sorted(cal().items())
+except:
+ print 'no input file'
diff --git a/evan69/0004/in.txt b/evan69/0004/in.txt
new file mode 100644
index 00000000..0d60d0a3
--- /dev/null
+++ b/evan69/0004/in.txt
@@ -0,0 +1,32 @@
+If you are looking for someone you can pour out your love to, let me suggest the empowered woman. The empowered woman knows what she wants, knows how to get it, knows how to live fully, and she knows how to love you back without needing anyone’s approval or recognition. An empowered woman is unarguably one of the most magnificent beings you will ever come in contact with. Read on and find 10 reason why you should absolutely love and embrace the empowered women in your life! .
+
+1. She knows how to love you in return
+It is difficult to give what you don’t have. It is impossible to love someone and feel fulfilled when they can’t love you in return because they don’t love themselves. This will never happen to you when you love an empowered woman. She loves herself (not in a narcissistic manner). In turn, she appreciates who you are and loves you in return. She will love you just like you deserve to be loved.
+
+2. She will inspire you
+When life puts you down and you are at the end of your rope, the empowered woman will be there to see you through. Her drive, enthusiasm and (at times) hopeless optimism will inspire you to carry on despite the obstacles you face.
+
+3. She is not afraid of failure
+While many out there are thoroughly terrified of failure, the empowered woman understands that failures are simply stepping stones in life. How can you not love someone that is thoroughly unafraid to try, fail, and give it a shot all over again?!
+
+4. She is all about the legacy
+While most people are focused on the car, the house, the job, and corner office; the empowered woman is focused on leaving a legacy that will inspire others and change the world. The empowered woman is focused on empowering others to maximize their potential and fulfill their purpose. She is all about inspiring others to look beyond themselves and live a life of service to others.
+
+5. She can laugh at her mistakes…
+…and learn from them as well! She understands mistakes are part of the journey. The empowered woman can laugh and learn from her mistakes to ensure they never happen again.
+
+6. She can be vulnerable
+The empowered woman understands there is no debt in relationships without vulnerability. Although she is emotionally strong, she is willing to laugh and cry with you because all of these emotions are an essential part of life.
+
+7. She can speak her mind
+While everyone else is too concerned with what others may think or say, the empowered woman is not afraid to speak her mind. She understands that her value comes from within, not from what others say or think about her.
+
+8. She knows when to remain quiet
+She lives by Abe Lincoln’s words, “Better to remain silent and be thought a fool, than to speak out and remove all doubt.”
+
+9. She knows how to have fun
+Whether it is at the symphony or at a ball game, the empowered woman understands life is made up of experiences with people – not the places you go. She is able to live in the moment and enjoy it fully without being concerned for the future. After all, who’s got a guaranteed future?
+
+10. She is not afraid of change
+While most people rather continue on living unfulfilled lives as long as their comfort zone remains intact, the empowered woman is all about embracing change. She understands growth cannot happen without change. She understands that change is the gift life offers you to choose your destiny. Therefore, she is not afraid of change because it is her stepping stone towards success.
+
diff --git a/evan69/0007/0007.py b/evan69/0007/0007.py
new file mode 100644
index 00000000..11d98525
--- /dev/null
+++ b/evan69/0007/0007.py
@@ -0,0 +1,37 @@
+#coding:utf8
+import sys,os,re
+
+def cal(path):
+ filelist = os.listdir(path)
+ #print filelist
+ filelist = (item for item in filelist if item.endswith('.py'))
+ ret = [0,0,0]
+ for item in filelist:
+ res = calfile(path,item)
+ for i in (0,1,2):
+ ret[i] += res[i]
+ return tuple(ret)
+
+def calfile(path,filename):
+ totline = 0
+ blankline = 0
+ commentline = 0
+ fileobj = open(path + filename,'r')
+ linelist = fileobj.readlines()
+ totline = len(linelist)
+ for line in linelist:
+ pattern = re.compile(r'(\s*)#')
+ pattern1 = re.compile(r'(\s*)$')
+ if pattern.match(line):
+ commentline += 1
+ if pattern1.match(line):
+ blankline += 1
+ fileobj.close()
+ return totline,blankline,commentline
+
+#path = r'/home/evan/Desktop/py/python/evan69/0007/'
+path = sys.argv[1]
+data = cal(path)
+dic = dict(zip(['total line','blank line','comment line'],list(data)))
+print dic
+
diff --git a/fybhp/.gitignore b/fybhp/.gitignore
new file mode 100644
index 00000000..2a7fcf79
--- /dev/null
+++ b/fybhp/.gitignore
@@ -0,0 +1,7 @@
+.idea
+fortest.py
+*.png
+*.jpg
+migrations
+*.sqlite
+*.pyc
\ No newline at end of file
diff --git a/fybhp/practice0/practice0.py b/fybhp/practice0/practice0.py
new file mode 100644
index 00000000..330b4897
--- /dev/null
+++ b/fybhp/practice0/practice0.py
@@ -0,0 +1,20 @@
+# -*- coding:utf-8 -*-
+import PIL
+from PIL import ImageFont
+from PIL import Image
+from PIL import ImageDraw
+
+#设置字体,如果没有,也可以不设置
+#font = ImageFont.truetype("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf",13)
+
+#打开底版图片
+imageFile = "./icon.jpg"
+im1=Image.open(imageFile)
+
+# 在图片上添加文字 1
+draw = ImageDraw.Draw(im1)
+draw.text((90, 5),"2",(255,0,0))#,font=font)
+draw = ImageDraw.Draw(im1)
+
+# 保存
+im1.save("./practice1/icon.png")
\ No newline at end of file
diff --git a/fybhp/practice1/practice1.py b/fybhp/practice1/practice1.py
new file mode 100644
index 00000000..3531a922
--- /dev/null
+++ b/fybhp/practice1/practice1.py
@@ -0,0 +1,22 @@
+# -*- coding:utf-8 -*-
+import re
+import string
+import random
+
+map = {}
+#pattern = re.compile(r'([a-z0-9A-Z]{4}-){3}([a-z0-9A-Z]{4})')
+#这个函数定义的很精髓
+def id_generator(size=4, chars=string.ascii_uppercase + string.digits + string.ascii_lowercase):
+ #[random.choice(chars) for _ in range(size)]为列表解析
+ #(random.choice(chars) for _ in range(size))为生成器,其对内存更友好
+ list = []
+ for i in range(4):
+ a = ''.join(random.choice(chars) for _ in range(size))
+ list.append(a)
+ return list
+for i in range(200):
+ id = '-'.join(id_generator())
+ while id in map.values():
+ id = '-'.join(id_generator())
+ map[i] = id
+print map
diff --git a/fybhp/practice10/arial.ttf b/fybhp/practice10/arial.ttf
new file mode 100644
index 00000000..886789b8
Binary files /dev/null and b/fybhp/practice10/arial.ttf differ
diff --git a/fybhp/practice10/practice10.py b/fybhp/practice10/practice10.py
new file mode 100644
index 00000000..1fadb5e3
--- /dev/null
+++ b/fybhp/practice10/practice10.py
@@ -0,0 +1,25 @@
+# -*- coding:utf-8 -*-
+import string
+import random
+from PIL import Image,ImageDraw,ImageFont,ImageFilter
+
+def numgenerator(size=4, chars=string.ascii_uppercase + string.digits + string.ascii_lowercase):
+ return ''.join(random.choice(chars) for _ in range(size))
+
+def getcolor():
+ return (random.randint(0,255),random.randint(0,255),random.randint(0,255))
+
+def getfont():
+ font = ImageFont.truetype('Arial.ttf',random.randint(50,65))
+ return font
+
+check = numgenerator()
+imageFile = "./bacdgroud.jpg"
+img = Image.open(imageFile)
+draw = ImageDraw.Draw(img)
+for i in range(4):
+ draw.text((72*i+random.randint(15,20), random.randint(5,10)),check[i],getcolor(),font=getfont())
+ draw = ImageDraw.Draw(img)
+image = img.filter(ImageFilter.BLUR)
+
+image.save("./test1.jpg")
diff --git a/fybhp/practice11/filter_words.txt b/fybhp/practice11/filter_words.txt
new file mode 100644
index 00000000..a5d1d90a
--- /dev/null
+++ b/fybhp/practice11/filter_words.txt
@@ -0,0 +1,11 @@
+
+Ա
+Ա
+쵼
+ţ
+ţ
+
+
+love
+sex
+jiangge
\ No newline at end of file
diff --git a/fybhp/practice11/practice11.py b/fybhp/practice11/practice11.py
new file mode 100644
index 00000000..17fe1bd8
--- /dev/null
+++ b/fybhp/practice11/practice11.py
@@ -0,0 +1,12 @@
+# -*- coding:utf-8 -*-
+
+list = []
+file = open('filter_words.txt','r')
+content = file.read().decode('gbk')
+allwords = content.split()
+#print allwords
+checkword = raw_input('>').decode('utf-8')
+if checkword in allwords:
+ print 'Freedom'
+else:
+ print 'Hunam Rights'
\ No newline at end of file
diff --git a/fybhp/practice12/filter_words.txt b/fybhp/practice12/filter_words.txt
new file mode 100644
index 00000000..a5d1d90a
--- /dev/null
+++ b/fybhp/practice12/filter_words.txt
@@ -0,0 +1,11 @@
+
+Ա
+Ա
+쵼
+ţ
+ţ
+
+
+love
+sex
+jiangge
\ No newline at end of file
diff --git a/fybhp/practice12/practice12.py b/fybhp/practice12/practice12.py
new file mode 100644
index 00000000..bfcd9c4d
--- /dev/null
+++ b/fybhp/practice12/practice12.py
@@ -0,0 +1,12 @@
+# -*- coding:utf-8 -*-
+import re
+list = []
+file = open('filter_words.txt','r')
+content = file.read().decode('gbk')
+allwords = content.split()
+#print allwords
+yourword = raw_input('>').decode('utf-8')
+for mingan in allwords:
+ if mingan in yourword:
+ yourword = re.sub(mingan,'*'*len(mingan),yourword)
+print yourword
\ No newline at end of file
diff --git a/fybhp/practice13/practice13/__init__.py b/fybhp/practice13/practice13/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/fybhp/practice13/practice13/items.py b/fybhp/practice13/practice13/items.py
new file mode 100644
index 00000000..abbf70e1
--- /dev/null
+++ b/fybhp/practice13/practice13/items.py
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+
+# Define here the models for your scraped items
+#
+# See documentation in:
+# http://doc.scrapy.org/en/latest/topics/items.html
+
+import scrapy
+
+
+class Practice13Item(scrapy.Item):
+ # define the fields for your item here like:
+ # name = scrapy.Field()
+ image_urls = scrapy.Field()
+ images = scrapy.Field()
+ image_paths = scrapy.Field()
+ pass
diff --git a/fybhp/practice13/practice13/pipelines.py b/fybhp/practice13/practice13/pipelines.py
new file mode 100644
index 00000000..f1276b9a
--- /dev/null
+++ b/fybhp/practice13/practice13/pipelines.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from scrapy.pipelines.images import ImagesPipeline
+from scrapy.exceptions import DropItem
+# Define your item pipelines here
+#
+# Don't forget to add your pipeline to the ITEM_PIPELINES setting
+# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
+
+
+class Practice13Pipeline(ImagesPipeline):
+ def get_media_requests(self, item, info):
+ for image_url in item['image_urls']:
+ yield scrapy.Request(image_url)
+
+ def item_completed(self, results, item, info):
+ image_paths = [x['path'] for ok, x in results if ok]
+ if not image_paths:
+ raise DropItem("Item contains no images")
+ item['image_paths'] = image_paths
+ return item
diff --git a/fybhp/practice13/practice13/settings.py b/fybhp/practice13/practice13/settings.py
new file mode 100644
index 00000000..08078b11
--- /dev/null
+++ b/fybhp/practice13/practice13/settings.py
@@ -0,0 +1,87 @@
+# -*- coding: utf-8 -*-
+
+# Scrapy settings for practice13 project
+#
+# For simplicity, this file contains only settings considered important or
+# commonly used. You can find more settings consulting the documentation:
+#
+# http://doc.scrapy.org/en/latest/topics/settings.html
+# http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
+# http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
+
+BOT_NAME = 'practice13'
+
+SPIDER_MODULES = ['practice13.spiders']
+NEWSPIDER_MODULE = 'practice13.spiders'
+
+ITEM_PIPELINES = {'practice13.pipelines.Practice13Pipeline': 1}
+
+IMAGES_STORE = '.'
+# Crawl responsibly by identifying yourself (and your website) on the user-agent
+#USER_AGENT = 'practice13 (+http://www.yourdomain.com)'
+
+# Configure maximum concurrent requests performed by Scrapy (default: 16)
+#CONCURRENT_REQUESTS=32
+
+# Configure a delay for requests for the same website (default: 0)
+# See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
+# See also autothrottle settings and docs
+#DOWNLOAD_DELAY=3
+# The download delay setting will honor only one of:
+#CONCURRENT_REQUESTS_PER_DOMAIN=16
+#CONCURRENT_REQUESTS_PER_IP=16
+
+# Disable cookies (enabled by default)
+#COOKIES_ENABLED=False
+
+# Disable Telnet Console (enabled by default)
+#TELNETCONSOLE_ENABLED=False
+
+# Override the default request headers:
+#DEFAULT_REQUEST_HEADERS = {
+# 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
+# 'Accept-Language': 'en',
+#}
+
+# Enable or disable spider middlewares
+# See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
+#SPIDER_MIDDLEWARES = {
+# 'practice13.middlewares.MyCustomSpiderMiddleware': 543,
+#}
+
+# Enable or disable downloader middlewares
+# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
+#DOWNLOADER_MIDDLEWARES = {
+# 'practice13.middlewares.MyCustomDownloaderMiddleware': 543,
+#}
+
+# Enable or disable extensions
+# See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
+#EXTENSIONS = {
+# 'scrapy.telnet.TelnetConsole': None,
+#}
+
+# Configure item pipelines
+# See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
+#ITEM_PIPELINES = {
+# 'practice13.pipelines.SomePipeline': 300,
+#}
+
+# Enable and configure the AutoThrottle extension (disabled by default)
+# See http://doc.scrapy.org/en/latest/topics/autothrottle.html
+# NOTE: AutoThrottle will honour the standard settings for concurrency and delay
+#AUTOTHROTTLE_ENABLED=True
+# The initial download delay
+#AUTOTHROTTLE_START_DELAY=5
+# The maximum download delay to be set in case of high latencies
+#AUTOTHROTTLE_MAX_DELAY=60
+# Enable showing throttling stats for every response received:
+#AUTOTHROTTLE_DEBUG=False
+
+# Enable and configure HTTP caching (disabled by default)
+# See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
+#HTTPCACHE_ENABLED=True
+#HTTPCACHE_EXPIRATION_SECS=0
+#HTTPCACHE_DIR='httpcache'
+#HTTPCACHE_IGNORE_HTTP_CODES=[]
+#HTTPCACHE_STORAGE='scrapy.extensions.httpcache.FilesystemCacheStorage'
diff --git a/fybhp/practice13/practice13/spiders/__init__.py b/fybhp/practice13/practice13/spiders/__init__.py
new file mode 100644
index 00000000..ebd689ac
--- /dev/null
+++ b/fybhp/practice13/practice13/spiders/__init__.py
@@ -0,0 +1,4 @@
+# This package will contain the spiders of your Scrapy project
+#
+# Please refer to the documentation for information on how to create and manage
+# your spiders.
diff --git a/fybhp/practice13/practice13/spiders/shanben.py b/fybhp/practice13/practice13/spiders/shanben.py
new file mode 100644
index 00000000..c8c622c3
--- /dev/null
+++ b/fybhp/practice13/practice13/spiders/shanben.py
@@ -0,0 +1,22 @@
+# -*- coding:utf-8 -*-
+import scrapy
+from scrapy.selector import Selector
+from practice13.items import Practice13Item
+
+class TiebapicSpider(scrapy.Spider):
+ name = "shan"
+ allowed_domains = ["tieba.baidu.com"]
+ start_urls = ['http://tieba.baidu.com/p/2166231880']
+
+ def parse(self,response):
+ sel = Selector(response)
+ div1 = sel.xpath('.//div[@class="d_post_content j_d_post_content clearfix"]')
+ #print div1
+ for single1 in div1:
+ div2 = single1.xpath('./img')
+ #print div2
+ for single2 in div2:
+ item = Practice13Item()
+ item['image_urls'] = [single2.xpath('./@src').extract()[0]]
+ print item['image_urls']
+ yield item
diff --git a/fybhp/practice13/scrapy.cfg b/fybhp/practice13/scrapy.cfg
new file mode 100644
index 00000000..f3853077
--- /dev/null
+++ b/fybhp/practice13/scrapy.cfg
@@ -0,0 +1,11 @@
+# Automatically created by: scrapy startproject
+#
+# For more information about the [deploy] section see:
+# https://scrapyd.readthedocs.org/en/latest/deploy.html
+
+[settings]
+default = practice13.settings
+
+[deploy]
+#url = http://localhost:6800/
+project = practice13
diff --git a/fybhp/practice14/practice14.py b/fybhp/practice14/practice14.py
new file mode 100644
index 00000000..85cb4f3e
--- /dev/null
+++ b/fybhp/practice14/practice14.py
@@ -0,0 +1,22 @@
+# -*- coding:utf-8 -*-
+from xlwt import Workbook
+import json
+
+file = open('student.txt','rb')
+text = file.read().decode('gbk')
+js = json.loads(text)
+book = Workbook()
+sheet = book.add_sheet('student')
+rownum = 0
+js2 = sorted(js)
+for i in js2:
+ colnum = 0
+ print i
+ sheet.write(rownum,colnum,unicode(i))
+ for item in js[i]:
+ print item
+ colnum += 1
+ sheet.write(rownum,colnum,unicode(item))
+ rownum += 1
+book.save('student.xls')
+
diff --git a/fybhp/practice14/student.txt b/fybhp/practice14/student.txt
new file mode 100644
index 00000000..ddb4a149
--- /dev/null
+++ b/fybhp/practice14/student.txt
@@ -0,0 +1,5 @@
+{
+ "1":["",150,120,100],
+ "2":["",90,99,95],
+ "3":["",60,66,68]
+}
\ No newline at end of file
diff --git a/fybhp/practice14/student.xls b/fybhp/practice14/student.xls
new file mode 100644
index 00000000..7d11669f
Binary files /dev/null and b/fybhp/practice14/student.xls differ
diff --git a/fybhp/practice15/city.txt b/fybhp/practice15/city.txt
new file mode 100644
index 00000000..4d62a75c
--- /dev/null
+++ b/fybhp/practice15/city.txt
@@ -0,0 +1,5 @@
+{
+ "1" : "Ϻ",
+ "2" : "",
+ "3" : "ɶ"
+}
\ No newline at end of file
diff --git a/fybhp/practice15/city.xls b/fybhp/practice15/city.xls
new file mode 100644
index 00000000..b020435b
Binary files /dev/null and b/fybhp/practice15/city.xls differ
diff --git a/fybhp/practice15/practice15.py b/fybhp/practice15/practice15.py
new file mode 100644
index 00000000..cb0fe3f0
--- /dev/null
+++ b/fybhp/practice15/practice15.py
@@ -0,0 +1,17 @@
+# -*- coding:utf-8 -*-
+from xlwt import Workbook
+import json
+
+file = open('city.txt','rb')
+text = file.read().decode('gbk')
+js = json.loads(text)
+book = Workbook()
+sheet = book.add_sheet('city')
+rownum = 0
+js2 = sorted(js)
+for i in js2:
+ colnum = 0
+ sheet.write(rownum,colnum,unicode(i))
+ sheet.write(rownum,colnum+1,unicode(js[i]))
+ rownum += 1
+book.save('city.xls')
\ No newline at end of file
diff --git a/Jimmy66/0016/numbers.txt b/fybhp/practice16/numbers.txt
similarity index 93%
rename from Jimmy66/0016/numbers.txt
rename to fybhp/practice16/numbers.txt
index 3c8c5a25..9f246488 100644
--- a/Jimmy66/0016/numbers.txt
+++ b/fybhp/practice16/numbers.txt
@@ -1,5 +1,5 @@
-[
- [1, 82, 65535],
- [20, 90, 13],
- [26, 809, 1024]
+[
+ [1, 82, 65535],
+ [20, 90, 13],
+ [26, 809, 1024]
]
\ No newline at end of file
diff --git a/fybhp/practice16/numbers.xls b/fybhp/practice16/numbers.xls
new file mode 100644
index 00000000..55d44312
Binary files /dev/null and b/fybhp/practice16/numbers.xls differ
diff --git a/fybhp/practice16/practice16.py b/fybhp/practice16/practice16.py
new file mode 100644
index 00000000..833afd1e
--- /dev/null
+++ b/fybhp/practice16/practice16.py
@@ -0,0 +1,16 @@
+# -*- coding:utf-8 -*-
+from xlwt import Workbook
+import json
+
+file = open('numbers.txt','rb')
+text = file.read()
+js = json.loads(text)
+book = Workbook()
+sheet = book.add_sheet('numbers')
+rownum = 0
+colnum = 0
+for i in range(len(js)):
+ for j in range(len(js[i])):
+ sheet.write(i,j,str(js[i][j]))
+ #rownum += 1
+book.save('numbers.xls')
\ No newline at end of file
diff --git a/fybhp/practice17/practice17.py b/fybhp/practice17/practice17.py
new file mode 100644
index 00000000..0ef7a944
--- /dev/null
+++ b/fybhp/practice17/practice17.py
@@ -0,0 +1,37 @@
+# -*- coding:utf-8 -*-
+from xml.dom import minidom
+from xlrd import open_workbook
+import json
+import re
+
+jdict = {}
+axls = open_workbook('student.xls')
+sheet1 = axls.sheet_by_name('student')
+for i in range(3):
+ sign = str(sheet1.cell(i,0).value)
+ jdict[sign] = []
+ for j in range(1,5):
+ if j > 1:
+ jdict[sign].append(int(sheet1.cell(i,j).value))
+ else:
+ jdict[sign].append(str(sheet1.cell(i,j).value).decode('gbk'))
+#jdata = json.dumps(jdict,indent=4, ensure_ascii=False)
+#导入jdata引号会出问题,只得导入jdict,但格式不好看,以下是黑科技,想出这种东西要逼疯我。
+s = str(jdict)
+s = re.sub('{','{\n\t ',s)
+s = re.sub('}','\n}',s)
+s = re.sub('],','],\n\t',s)
+print s
+doc = minidom.Document()
+root = doc.createElement('root')
+doc.appendChild(root)
+students = doc.createElement('students')
+comment = doc.createComment(u'\n\t学生信息表\n\t"id" : [名字, 数学, 语文, 英文]\n')
+students.appendChild(comment)
+students_text = doc.createTextNode(s.decode('unicode_escape'))
+students.appendChild(students_text)
+root.appendChild(students)
+f = open("student.xml", "wb")
+f.write(doc.toprettyxml(indent = "", newl = "\n", encoding = "utf-8"))
+f.close()
+
diff --git a/fybhp/practice17/student.xls b/fybhp/practice17/student.xls
new file mode 100644
index 00000000..4b3c08f4
Binary files /dev/null and b/fybhp/practice17/student.xls differ
diff --git a/fybhp/practice17/student.xml b/fybhp/practice17/student.xml
new file mode 100644
index 00000000..dca51733
--- /dev/null
+++ b/fybhp/practice17/student.xml
@@ -0,0 +1,14 @@
+
+
+
+
+{
+ '1': [u'张三', 150, 120, 100],
+ '3': [u'王五', 60, 66, 68],
+ '2': [u'李四', 90, 99, 95]
+}
+
+
diff --git a/fybhp/practice18/city.xls b/fybhp/practice18/city.xls
new file mode 100644
index 00000000..d74e1908
Binary files /dev/null and b/fybhp/practice18/city.xls differ
diff --git a/fybhp/practice18/city.xml b/fybhp/practice18/city.xml
new file mode 100644
index 00000000..cd005692
--- /dev/null
+++ b/fybhp/practice18/city.xml
@@ -0,0 +1,13 @@
+
+
+
+
+{
+ '1': u'上海',
+ '3': u'成都',
+ '2': u'北京'
+}
+
+
diff --git a/fybhp/practice18/practice18.py b/fybhp/practice18/practice18.py
new file mode 100644
index 00000000..7f7bafd2
--- /dev/null
+++ b/fybhp/practice18/practice18.py
@@ -0,0 +1,27 @@
+# -*- coding:utf-8 -*-
+from xml.dom import minidom
+from xlrd import open_workbook
+import re
+
+jdict = {}
+axls = open_workbook('city.xls')
+sheet1 = axls.sheet_by_name('city')
+for i in range(3):
+ jdict[str(sheet1.cell(i,0).value)] = str(sheet1.cell(i,1).value).decode('gbk')
+s = str(jdict)
+s = re.sub('{','{\n\t ',s)
+s = re.sub('}','\n}',s)
+s = re.sub(',',',\n\t',s)
+print s
+doc = minidom.Document()
+root = doc.createElement('root')
+doc.appendChild(root)
+students = doc.createElement('citys')
+comment = doc.createComment(u'\n\t城市信息\n')
+students.appendChild(comment)
+students_text = doc.createTextNode(s.decode('unicode_escape'))
+students.appendChild(students_text)
+root.appendChild(students)
+f = open("city.xml", "wb")
+f.write(doc.toprettyxml(indent = "", newl = "\n", encoding = "utf-8"))
+f.close()
\ No newline at end of file
diff --git a/fybhp/practice19/numbers.xls b/fybhp/practice19/numbers.xls
new file mode 100644
index 00000000..55d44312
Binary files /dev/null and b/fybhp/practice19/numbers.xls differ
diff --git a/fybhp/practice19/numbers.xml b/fybhp/practice19/numbers.xml
new file mode 100644
index 00000000..3ed26b87
--- /dev/null
+++ b/fybhp/practice19/numbers.xml
@@ -0,0 +1,13 @@
+
+
+
+
+[
+ [1, 82, 65535],
+ [20, 90, 13],
+ [26, 809, 1024]
+]
+
+
diff --git a/fybhp/practice19/practice19.py b/fybhp/practice19/practice19.py
new file mode 100644
index 00000000..b1cdc066
--- /dev/null
+++ b/fybhp/practice19/practice19.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+from xml.dom import minidom
+from xlrd import open_workbook
+import re
+
+jdict = []
+axls = open_workbook('numbers.xls')
+sheet1 = axls.sheet_by_name('numbers')
+for i in range(3):
+ jdict.append([])
+ for j in range(3):
+ jdict[i].append(int(sheet1.cell(i,j).value))
+s = str(jdict)
+print s
+s = re.sub('\[\[','[\n\t [',s)
+s = re.sub('\]\]',']\n]',s)
+s = re.sub('],','],\n\t',s)
+print s
+doc = minidom.Document()
+root = doc.createElement('root')
+doc.appendChild(root)
+students = doc.createElement('numbers')
+comment = doc.createComment(u'\n\t数字信息\n')
+students.appendChild(comment)
+students_text = doc.createTextNode(s)
+students.appendChild(students_text)
+root.appendChild(students)
+f = open("numbers.xml", "wb")
+f.write(doc.toprettyxml(indent = "", newl = "\n", encoding = "utf-8"))
+f.close()
\ No newline at end of file
diff --git a/fybhp/practice2/pra2.sql b/fybhp/practice2/pra2.sql
new file mode 100644
index 00000000..13316482
--- /dev/null
+++ b/fybhp/practice2/pra2.sql
@@ -0,0 +1,7 @@
+use activation_code;
+CREATE TABLE MyGenerateCode
+(
+ SerialNumber int(5) NOT NULL,
+ ActivationCode char(30) NOT NULL
+);
+ALTER TABLE MyGenerateCode ADD PRIMARY KEY (SerialNumber);
diff --git a/fybhp/practice2/practice2.py b/fybhp/practice2/practice2.py
new file mode 100644
index 00000000..0512893d
--- /dev/null
+++ b/fybhp/practice2/practice2.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+import MySQLdb
+import MySQLdb.cursors
+import string
+import random
+
+# 表在workbench中已建好.sql语句见pra2.sql
+# 该方法较为底层了,有时间再用SQLAlchemy来实现此脚本.
+map = {}
+db = MySQLdb.connect(host='localhost',user='root',passwd='501826')
+curs = db.cursor()
+db.select_db('activation_code')
+
+def id_generator(size=4, chars=string.ascii_uppercase + string.digits + string.ascii_lowercase):
+ set = []
+ for i in range(4):
+ a = ''.join(random.choice(chars) for _ in range(size))
+ set.append(a)
+ return set
+
+for i in range(200):
+ id = '-'.join(id_generator())
+ while id in map.values():
+ id = '-'.join(id_generator())
+ map[i] = id
+ curs.execute('insert into mygeneratecode values(%d,%r)'%(i,map[i]))
+
+db.commit()
+curs.close()
+db.close()
\ No newline at end of file
diff --git a/fybhp/practice20/practice20.py b/fybhp/practice20/practice20.py
new file mode 100644
index 00000000..e69de29b
diff --git a/fybhp/practice21/practice21.py b/fybhp/practice21/practice21.py
new file mode 100644
index 00000000..b24946ae
--- /dev/null
+++ b/fybhp/practice21/practice21.py
@@ -0,0 +1,26 @@
+# -*-coding:utf-8-*-
+import redis
+from werkzeug.security import generate_password_hash, check_password_hash
+
+#建立redis数据库连接.
+db = redis.Redis(host = 'localhost',port = 6379,db = 0)
+
+while True:
+ option = raw_input(u'请选择:\n1.注册\n2.登陆\n')
+ if option == '1':
+ Username = raw_input(u'请输入用户名:')
+ if db.exists(Username):
+ print u'用户已存在。'
+ continue
+ Set_password = raw_input(u'请设置密码:')
+ password_hash = generate_password_hash(Set_password)
+ db.set(Username,password_hash)
+ if option == '2':
+ Username = raw_input(u'用户名:')
+ password_hash = db.get(Username)
+ password = raw_input(u'请输入密码:')
+ if check_password_hash(password_hash,password):
+ print u'登陆成功。'
+ else:
+ print u'用户名或密码错误。'
+
diff --git a/fybhp/practice23/logical.py b/fybhp/practice23/logical.py
new file mode 100644
index 00000000..2d64da73
--- /dev/null
+++ b/fybhp/practice23/logical.py
@@ -0,0 +1,48 @@
+# -*- coding:utf-8 -*-
+import redis
+from flask import Flask,render_template,url_for,redirect
+from flask.ext.migrate import Migrate,MigrateCommand
+from flask.ext.bootstrap import Bootstrap
+from flask.ext.wtf import Form
+from flask.ext.sqlalchemy import SQLAlchemy
+from flask.ext.script import Shell,Manager
+from wtforms import StringField,SubmitField,TextAreaField
+from wtforms.validators import Required
+from datetime import datetime
+import os
+
+app = Flask(__name__)
+app.config['SECRET_KEY'] = 'gudabaidemima'
+basedir = os.path.abspath(os.path.dirname(__file__))
+app.config['SQLALCHEMY_DATABASE_URI'] = \
+ 'sqlite:///'+os.path.join(basedir,'data.sqlite')
+app.config['SQLALCHEMY_COMMIT_ON_TEARDOWN'] = True
+bootstrap = Bootstrap(app)
+db = SQLAlchemy(app)
+migrate = Migrate(app,db)
+manager = Manager(app)
+manager.add_command('db', MigrateCommand)
+
+class Message(Form):
+ name = StringField(u'姓名',validators=[Required()])
+ message = TextAreaField(u'内容',validators=[Required()])
+ submit = SubmitField(u'提交')
+
+class Messages(db.Model):
+ __tablename__ = 'messages'
+ name = db.Column(db.String)
+ message = db.Column(db.Text)
+ time = db.Column(db.String,default = datetime.utcnow,primary_key = True)
+
+@app.route('/',methods = ['GET','POST'])
+def index():
+ form = Message()
+ messages = Messages.query.order_by(Messages.time.desc()).all()
+ if form.validate_on_submit():
+ message = Messages(name=form.name.data,message = form.message.data)
+ db.session.add(message)
+ return redirect(url_for('index'))
+ return render_template('index.html',messages = messages,form = form)
+
+if __name__ == '__main__':
+ manager.run()
\ No newline at end of file
diff --git a/fybhp/practice23/templates/_posts.html b/fybhp/practice23/templates/_posts.html
new file mode 100644
index 00000000..aa99c610
--- /dev/null
+++ b/fybhp/practice23/templates/_posts.html
@@ -0,0 +1,15 @@
+
+{% endblock %}
\ No newline at end of file
diff --git a/fybhp/practice3/practice3.py b/fybhp/practice3/practice3.py
new file mode 100644
index 00000000..274b2ad7
--- /dev/null
+++ b/fybhp/practice3/practice3.py
@@ -0,0 +1,28 @@
+# -*- coding:utf-8 -*-
+import redis
+import string
+import random
+
+map = {}
+db = redis.Redis(host = 'localhost',port = 6379,db = 0)
+p = db.pipeline()
+
+def id_generator(size=4, chars=string.ascii_uppercase + string.digits + string.ascii_lowercase):
+ set = []
+ for i in range(4):
+ a = ''.join(random.choice(chars) for _ in range(size))
+ set.append(a)
+ return set
+
+for i in range(200):
+ id = '-'.join(id_generator())
+ while id in map.values():
+ id = '-'.join(id_generator())
+ map[i] = id
+ p.set(i,map[i])
+
+p.execute()
+p.save()
+#for i in range(200):
+ #print str(i) + str(db.get(i))
+print db.keys()
\ No newline at end of file
diff --git a/fybhp/practice4/English.txt b/fybhp/practice4/English.txt
new file mode 100644
index 00000000..5a9e1e92
--- /dev/null
+++ b/fybhp/practice4/English.txt
@@ -0,0 +1,15 @@
+You are watching a film in which two men are having a fight. They hit one another hard. At the start they only fight with their fists. But soon they begin hitting one another over the heads with chairs. And so it goes on until one of the men crashes through a window and falls thirty feet to the ground below. He is deadOf course he isn't really dead. With any luck he isn't even hurt. Why? Because the men who fall out of high windows or jump from fast moving trains, who crash cars of even catch fire, are professionals. They do this for a living. These men are called stuntmen. That is to say, they perform tricks.There are two sides to their work. They actually do most of the things you see on the screen. For example, they fall from a high building. However, they do not fall on to hard ground but on to empty cardboard boxes covered with a mattress . Again, when they hit one another with chairs, the chairs are made of soft wood and when they crash through windows, the glass is made of sugar!But although their work depends on trick of this sort, it also requires a high degree of skill and training. Often a stuntman' s success depends on careful timing. For example, when he is "blown up" in a battle scene, he has to jump out of the way of the explosion just at the right moment.
+
+Naturally stuntmen are well paid for their work, but they lead dangerous lives. They often get seriously injured, and sometimes killed. A Norwegian stuntman, for example, skied over the edge of a cliff a thousand feet high. His parachute failed to open, and he was killed. In spite of all the risks, this is no longer a profession for men only. Men no longer dress up as women when actresses have to perform some dangerous action. For nowadays there are stuntgirls tool.
+In some ways, the United States has made some progress. Fires no longer destroy 18,000 buildings as they did in the Great Chicago Fire of 1871, or kill half a town of 2,400 people, as they did the same night in Peshtigo, Wisconsin. Other than the Beverly Hill Supper Club fire in Kentucky in 1977, it has been four decades since more than 100 Americans died in a fire.
+
+But even with such successes, the United States still has one of the worst fire death rates in the world. Safety experts say the problem is neither money nor technology, but the indifference of a country that just will not take fires seriously enough.
+
+American fire departments are some of the world's fastest and best-equipped. They have to be. The United States has twice Japan's population, and 40 times as many fires. It spends far less on preventing fires than on fighting them. And American fire -safety lessons are aimed almost entirely at children, who die in large numbers in fires but who, against popular beliefs, start very few of them.
+
+Experts say the error is an opinion that fires are not really anyone's fault. That is not so in other countries, where both public education and the law treat fires as either a personal failing or a crime. Japan has many wood houses; of the 48 fires in world history that burned more than 10,000 buildings, Japan has had 27. Punishment for causing a big fire can be as severe as life imprisonment.
+
+In the United States, most education dollars are spent in elementary schools. But, the lessons are aimed at too limited a number of people; just 9 percent of all fire deaths are caused by children playing with matches.
+
+The United States continues to depend more on technology than laws or social pressure. There are smoke detectors in 85 percent of all homes. Some local building laws now require home sprinklers . New heaters and irons shut themselves off if they are tipped.
+Today is the date of that afternoon in April a year ago when I first saw the strange and attractive doll in the window of Abe Sheftel's toy shop on Third Avenue near Fifteenth Street, just around the corner from my office, where the plate on the door reads. Dr Samuel Amory. I remember just how it was that day: the first sign of spring floated across the East River, mixing with the soft - coal smoke from the factories and the street smells of the poor neighbourhood. As I turned the corner on my way to work and came to Sheftel's, I was made once more known of the poor collection of toys in the dusty window, and I remembered the coming birthday of a small niece of mine in Cleveland, to whom I was in the habit of sending small gifts. Therefore, I stopped and examined the window to see if there might be anything suitable, and looked at the collection of unattractive objects--a red toy fire engine, some lead soldiers, cheap baseballs, bottles of ink, pens, yellowed envelopes, and advertisements for soft - drinks. And thus it was that my eyes finally came to rest upon the doll stored away in one corner, a doll with the strangest, most charming expression on her face. I could not wholly make her out, due to the shadows and the film of dust through which I was looking, but I was sure that a deep impression had been made upon me as though I had run into a person, as one does sometimes with a stranger, with whose personality one is deeply impressed.
\ No newline at end of file
diff --git a/fybhp/practice4/practice4(2).py b/fybhp/practice4/practice4(2).py
new file mode 100644
index 00000000..6e7b833a
--- /dev/null
+++ b/fybhp/practice4/practice4(2).py
@@ -0,0 +1,33 @@
+# -*- coding:utf-8 -*-
+
+file = open('./English.txt','r')
+s = set()
+map = {}
+allLines = file.readlines()
+
+def pre(i):
+ if not i in s:
+ map[i] = 1
+ s.add(i)
+ else:
+ map[i] += 1
+
+for eachLine in allLines:
+ alist = eachLine.split()
+ if alist != []:
+ for i in alist:
+ i = i.lower()
+ if i[-1] == '.' or i[-1] == ',' or i[-1] == "'" or i[-1] == '?' :
+ i = i[:-1]
+ if i == '':
+ continue
+ if '.' in i:
+ a = i.split('.')
+ for j in a:
+ pre(j)
+ continue
+ pre(i)
+ else:
+ pass
+print s
+print map
\ No newline at end of file
diff --git a/fybhp/practice4/practice4.py b/fybhp/practice4/practice4.py
new file mode 100644
index 00000000..3daf5e9c
--- /dev/null
+++ b/fybhp/practice4/practice4.py
@@ -0,0 +1,28 @@
+# -*- coding:utf-8 -*-
+import redis
+
+db = redis.Redis(host = 'localhost',port = 6379,db = 0)
+file = open('./English.txt','r')
+s = set()
+map = {}
+allLines = file.readlines()
+for eachLine in allLines:
+ alist = eachLine.split()
+ if alist != []:
+ for i in alist:
+ if i[-1] == '.':
+ i = i[:-1]
+ if i == '':
+ continue
+ i = i.lower()
+ if not i in s:
+ db.set(i,1)
+ s.add(i)
+ else:
+ db.incr(i)
+ else:
+ pass
+print s
+for i in s:
+ map[i] = db.get(i)
+print map
\ No newline at end of file
diff --git a/fybhp/practice5/iphone5/[FLsnow][Fate_stay_night][02][BDrip][1080p][AVC_FLAC]_2015731214139.JPG b/fybhp/practice5/iphone5/[FLsnow][Fate_stay_night][02][BDrip][1080p][AVC_FLAC]_2015731214139.JPG
new file mode 100644
index 00000000..8c9ec81a
Binary files /dev/null and b/fybhp/practice5/iphone5/[FLsnow][Fate_stay_night][02][BDrip][1080p][AVC_FLAC]_2015731214139.JPG differ
diff --git a/fybhp/practice5/iphone5/[FLsnow][Fate_stay_night][07][BDrip][1080p][AVC_FLAC]_20158411234.JPG b/fybhp/practice5/iphone5/[FLsnow][Fate_stay_night][07][BDrip][1080p][AVC_FLAC]_20158411234.JPG
new file mode 100644
index 00000000..ce1f1c91
Binary files /dev/null and b/fybhp/practice5/iphone5/[FLsnow][Fate_stay_night][07][BDrip][1080p][AVC_FLAC]_20158411234.JPG differ
diff --git a/fybhp/practice5/iphone5/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215121.JPG b/fybhp/practice5/iphone5/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215121.JPG
new file mode 100644
index 00000000..3cf4f8c5
Binary files /dev/null and b/fybhp/practice5/iphone5/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215121.JPG differ
diff --git a/fybhp/practice5/iphone5/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215128.JPG b/fybhp/practice5/iphone5/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215128.JPG
new file mode 100644
index 00000000..2c916263
Binary files /dev/null and b/fybhp/practice5/iphone5/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215128.JPG differ
diff --git a/fybhp/practice5/iphone5/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215521.JPG b/fybhp/practice5/iphone5/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215521.JPG
new file mode 100644
index 00000000..4c8ac243
Binary files /dev/null and b/fybhp/practice5/iphone5/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215521.JPG differ
diff --git a/fybhp/practice5/pic/[FLsnow][Fate_stay_night][02][BDrip][1080p][AVC_FLAC]_2015731214139.JPG b/fybhp/practice5/pic/[FLsnow][Fate_stay_night][02][BDrip][1080p][AVC_FLAC]_2015731214139.JPG
new file mode 100644
index 00000000..7e517672
Binary files /dev/null and b/fybhp/practice5/pic/[FLsnow][Fate_stay_night][02][BDrip][1080p][AVC_FLAC]_2015731214139.JPG differ
diff --git a/fybhp/practice5/pic/[FLsnow][Fate_stay_night][07][BDrip][1080p][AVC_FLAC]_20158411234.JPG b/fybhp/practice5/pic/[FLsnow][Fate_stay_night][07][BDrip][1080p][AVC_FLAC]_20158411234.JPG
new file mode 100644
index 00000000..83509845
Binary files /dev/null and b/fybhp/practice5/pic/[FLsnow][Fate_stay_night][07][BDrip][1080p][AVC_FLAC]_20158411234.JPG differ
diff --git a/fybhp/practice5/pic/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215121.JPG b/fybhp/practice5/pic/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215121.JPG
new file mode 100644
index 00000000..d6aaa475
Binary files /dev/null and b/fybhp/practice5/pic/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215121.JPG differ
diff --git a/fybhp/practice5/pic/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215128.JPG b/fybhp/practice5/pic/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215128.JPG
new file mode 100644
index 00000000..ea2ebd33
Binary files /dev/null and b/fybhp/practice5/pic/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215128.JPG differ
diff --git a/fybhp/practice5/pic/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215521.JPG b/fybhp/practice5/pic/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215521.JPG
new file mode 100644
index 00000000..cd628dfd
Binary files /dev/null and b/fybhp/practice5/pic/[LAC][Gintama][Gekijouban_Gintama_Kanketsuhen_Yorozuya_yo_Eien_Nare][x264_aac][GB][720P]_201559215521.JPG differ
diff --git a/fybhp/practice5/practice5.py b/fybhp/practice5/practice5.py
new file mode 100644
index 00000000..b498d599
--- /dev/null
+++ b/fybhp/practice5/practice5.py
@@ -0,0 +1,39 @@
+# -*- coding:utf-8 -*-
+from __future__ import division
+from PIL import Image
+import os
+
+#按比例缩放
+picdir = r'./pic'
+file_list = os.walk(picdir)
+thumbdir = r'./iphone5/'
+ip5lo = 1136
+ip5sh = 640
+if not os.path.exists(thumbdir):
+ os.mkdir(thumbdir)
+for root, dirs, files in file_list:
+ #print file
+ for file in files:
+ filedir = os.path.join(picdir,file)
+ img = Image.open(filedir)
+ imgSize = img.size
+ lo = max(imgSize)
+ sh = min(imgSize)
+ rate = lo/sh
+ newfiledir = os.path.join(thumbdir,file)
+ if sh > ip5sh or lo > ip5lo :
+ #此处亦有两种方法 sh2 = ip5lo/rate,再进行四种分类。
+ #可将两方法相比,计算收缩比率,收缩比率小的获胜,有必要时再如此处理吧。
+ lo2 = ip5sh*rate
+ print lo2
+ if lo2 > ip5lo and imgSize[0] > imgSize[1]:
+ new_img = img.resize((ip5lo,int(ip5lo/rate)),Image.ANTIALIAS)
+ elif lo2 > ip5lo and imgSize[0] < imgSize[1]:
+ new_img = img.resize((int(ip5lo/rate),ip5lo),Image.ANTIALIAS)
+ elif lo2 < ip5lo and imgSize[0] > imgSize[1]:
+ new_img = img.resize((int(lo2),ip5sh),Image.ANTIALIAS)
+ else:
+ new_img = img.resize((ip5sh,int(lo2)),Image.ANTIALIAS)
+ new_img.save(newfiledir,quality = 100)
+ else:
+ img.save(newfiledir,quality = 100)
diff --git a/fybhp/practice6/diary/diary1.txt b/fybhp/practice6/diary/diary1.txt
new file mode 100644
index 00000000..41fc2673
--- /dev/null
+++ b/fybhp/practice6/diary/diary1.txt
@@ -0,0 +1,9 @@
+You are watching a film in which two men are having a fight. They hit one another hard. At the start they only fight with their fists. But soon they begin hitting one another over the heads with chairs. And so it goes on until one of the men crashes through a window and falls thirty feet to the ground below. He is deadOf course he isn't really dead. With any luck he isn't even hurt. Why? Because the men who fall out of high windows or jump from fast moving trains, who crash cars of even catch fire, are professionals. They do this for a living. These men are called stuntmen. That is to say, they perform tricks.There are two sides to their work. They actually do most of the things you see on the screen. For example, they fall from a high building. However, they do not fall on to hard ground but on to empty cardboard boxes covered with a mattress . Again, when they hit one another with chairs, the chairs are made of soft wood and when they crash through windows, the glass is made of sugar!But although their work depends on trick of this sort, it also requires a high degree of skill and training. Often a stuntman' s success depends on careful timing. For example, when he is "blown up" in a battle scene, he has to jump out of the way of the explosion just at the right moment.
+
+Naturally stuntmen are well paid for their work, but they lead dangerous lives. They often get seriously injured, and sometimes killed. A Norwegian stuntman, for example, skied over the edge of a cliff a thousand feet high. His parachute failed to open, and he was killed. In spite of all the risks, this is no longer a profession for men only. Men no longer dress up as women when actresses have to perform some dangerous action. For nowadays there are stuntgirls tool.
+In some ways, the United States has made some progress. Fires no longer destroy 18,000 buildings as they did in the Great Chicago Fire of 1871, or kill half a town of 2,400 people, as they did the same night in Peshtigo, Wisconsin. Other than the Beverly Hill Supper Club fire in Kentucky in 1977, it has been four decades since more than 100 Americans died in a fire.
+
+But even with such successes, the United States still has one of the worst fire death rates in the world. Safety experts say the problem is neither money nor technology, but the indifference of a country that just will not take fires seriously enough.
+
+American fire departments are some of the world's fastest and best-equipped. They have to be. The United States has twice Japan's population, and 40 times as many fires. It spends far less on preventing fires than on fighting them. And American fire -safety lessons are aimed almost entirely at children, who die in large numbers in fires but who, against popular beliefs, start very few of them.
+
diff --git a/fybhp/practice6/diary/diary2.txt b/fybhp/practice6/diary/diary2.txt
new file mode 100644
index 00000000..3d00bd58
--- /dev/null
+++ b/fybhp/practice6/diary/diary2.txt
@@ -0,0 +1,6 @@
+Experts say the error is an opinion that fires are not really anyone's fault. That is not so in other countries, where both public education and the law treat fires as either a personal failing or a crime. Japan has many wood houses; of the 48 fires in world history that burned more than 10,000 buildings, Japan has had 27. Punishment for causing a big fire can be as severe as life imprisonment.
+
+In the United States, most education dollars are spent in elementary schools. But, the lessons are aimed at too limited a number of people; just 9 percent of all fire deaths are caused by children playing with matches.
+
+The United States continues to depend more on technology than laws or social pressure. There are smoke detectors in 85 percent of all homes. Some local building laws now require home sprinklers . New heaters and irons shut themselves off if they are tipped.
+Today is the date of that afternoon in April a year ago when I first saw the strange and attractive doll in the window of Abe Sheftel's toy shop on Third Avenue near Fifteenth Street, just around the corner from my office, where the plate on the door reads. Dr Samuel Amory. I remember just how it was that day: the first sign of spring floated across the East River, mixing with the soft - coal smoke from the factories and the street smells of the poor neighbourhood. As I turned the corner on my way to work and came to Sheftel's, I was made once more known of the poor collection of toys in the dusty window, and I remembered the coming birthday of a small niece of mine in Cleveland, to whom I was in the habit of sending small gifts. Therefore, I stopped and examined the window to see if there might be anything suitable, and looked at the collection of unattractive objects--a red toy fire engine, some lead soldiers, cheap baseballs, bottles of ink, pens, yellowed envelopes, and advertisements for soft - drinks. And thus it was that my eyes finally came to rest upon the doll stored away in one corner, a doll with the strangest, most charming expression on her face. I could not wholly make her out, due to the shadows and the film of dust through which I was looking, but I was sure that a deep impression had been made upon me as though I had run into a person, as one does sometimes with a stranger, with whose personality one is deeply impressed.
\ No newline at end of file
diff --git a/fybhp/practice6/diary/diary3.txt b/fybhp/practice6/diary/diary3.txt
new file mode 100644
index 00000000..39ca7e6f
--- /dev/null
+++ b/fybhp/practice6/diary/diary3.txt
@@ -0,0 +1 @@
+the and to to to. to'
\ No newline at end of file
diff --git a/fybhp/practice6/practice6.py b/fybhp/practice6/practice6.py
new file mode 100644
index 00000000..d66f4fad
--- /dev/null
+++ b/fybhp/practice6/practice6.py
@@ -0,0 +1,51 @@
+# -*- coding:utf-8 -*-
+import os
+
+'''practice5中遍历目录中文件的方法,读取所有文件,
+practice4中对单词计数的方法,对所有词进行计数,
+完成对map字典的排序即可。'''
+diarydir = r'./diary/'
+file_list = os.walk(diarydir)
+s = set()
+map = {}
+
+def pre(i,s):
+ if not i in s:
+ map[i] = 1
+ s.add(i)
+ else:
+ map[i] += 1
+
+def parselines(allLines):
+ for eachLine in allLines:
+ #将set置于此处,控制其作用域。
+ s = set()
+ alist = eachLine.split()
+ if alist != []:
+ for i in alist:
+ i = i.lower()
+ if i[-1] == '.' or i[-1] == ',' or i[-1] == "'" or i[-1] == '?' :
+ i = i[:-1]
+ if i == '':
+ continue
+ if '.' in i:
+ a = i.split('.')
+ for j in a:
+ pre(j,s)
+ continue
+ pre(i,s)
+ else:
+ pass
+
+for root, dirs, files in file_list:
+ for file in files:
+ map = {}
+ filedir = os.path.join(diarydir,file)
+ diary = open(filedir,'r')
+ allLines = diary.readlines()
+ parselines(allLines)
+ #黑科技。
+ dict= sorted(map.iteritems(), key=lambda d:d[1], reverse = True)
+ print str(file)+'\n'
+ print dict
+ del map
\ No newline at end of file
diff --git a/fybhp/practice7/practice7.py b/fybhp/practice7/practice7.py
new file mode 100644
index 00000000..5252536d
--- /dev/null
+++ b/fybhp/practice7/practice7.py
@@ -0,0 +1,32 @@
+# -*- coding:utf-8 -*-
+import os
+
+#用字典结构表示,更为清晰。
+map = {}
+map['blank'] = 0
+map['annotation'] = 0
+map['all'] = 0
+dir = r'E://somegit/pracpro/'
+file_list = os.walk(dir)
+
+def parsefile(filedir):
+ #可以此控制计算的文件类型,如加上'.sql'等,都很容易。
+ if filedir[-3:] == '.py':
+ h = open(filedir,'r')
+ allLines = h.readlines()
+ for line in allLines:
+ line = line.strip()
+ if line == '':
+ map['blank'] += 1
+ elif line[0] == '#':
+ map['annotation'] += 1
+ map['all'] += len(allLines)
+
+#这几行很重要。
+for root, dirs, files in file_list:
+ for name in files:
+ #特别是这一行。
+ filedir = root+'/'+name
+ parsefile(filedir)
+
+print map
\ No newline at end of file
diff --git a/fybhp/practice8/AGitPro.html b/fybhp/practice8/AGitPro.html
new file mode 100644
index 00000000..119983d8
--- /dev/null
+++ b/fybhp/practice8/AGitPro.html
@@ -0,0 +1,878 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GitHub - Yixiaohan/show-me-the-code: Python 练习册,每天一个小程序
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Skip to content
+
+
+
+
第 0024 题: 使用 Python 的 Web 框架,做一个 Web 版本 TodoList 应用。
+
+
+
+
+
+
第 0025 题: 使用 Python 实现:对着电脑吼一声,自动打开浏览器中的默认网站。
+
+
例如,对着笔记本电脑吼一声“百度”,浏览器自动打开百度首页。
+
+关键字:Speech to Text
+
+
+
参考思路:
+1:获取电脑录音-->WAV文件
+ python record wav
+
+
2:录音文件-->文本
+
+
STT: Speech to Text
+
+STT API Google API
+
+
+
3:文本-->电脑命令
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Something went wrong with that request. Please try again.
+
+
+
+
+
+ You signed in with another tab or window. Reload to refresh your session.
+ You signed out in another tab or window. Reload to refresh your session.
+
第 0024 题: 使用 Python 的 Web 框架,做一个 Web 版本 TodoList 应用。
+
+
+
+
+
+
第 0025 题: 使用 Python 实现:对着电脑吼一声,自动打开浏览器中的默认网站。
+
+
例如,对着笔记本电脑吼一声“百度”,浏览器自动打开百度首页。
+
+关键字:Speech to Text
+
+
+
参考思路:
+1:获取电脑录音-->WAV文件
+ python record wav
+
+
2:录音文件-->文本
+
+
STT: Speech to Text
+
+STT API Google API
+
+
+
3:文本-->电脑命令
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Something went wrong with that request. Please try again.
+
+
+
+
+
+ You signed in with another tab or window. Reload to refresh your session.
+ You signed out in another tab or window. Reload to refresh your session.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/fybhp/practice9/practice9.py b/fybhp/practice9/practice9.py
new file mode 100644
index 00000000..c5adc3d4
--- /dev/null
+++ b/fybhp/practice9/practice9.py
@@ -0,0 +1,6 @@
+# -*- coding:utf-8 -*-
+from bs4 import BeautifulSoup
+
+soup = BeautifulSoup(open('AGitPro.html'),'lxml')
+for link in soup.find_all('a'):
+ print link['href']
\ No newline at end of file
diff --git a/houshengandt/readme.md b/houshengandt/readme.md
new file mode 100644
index 00000000..8d260923
--- /dev/null
+++ b/houshengandt/readme.md
@@ -0,0 +1,28 @@
+#My Repository
+##My-Solutions-For-Show-Me-the-Code
+https://github.com/houshengandt/My-Solutions-For-Show-Me-The-Code
+##关于第0025题百度语音解法
+https://github.com/houshengandt/My-Solutions-For-Show-Me-The-Code/blob/master/0025/help.md
+
+###使用方法
+`python3 0025.py`
+
+在 输出 正在录音...... 时喊出你想打开的网站,录音时间有5秒,之后会上传。
+目前支持“百度”“微博”“谷歌”,可以在代码中的dict website 里添加你想要的网站,但注意识别不是百分百准确,每个人口音也有差异,根据识别结果来调整value值。
+
+######题目
+[Python 练习册,每天一个小程序](https://github.com/Yixiaohan/show-me-the-code)
+>第 0025 题: 使用Python实现:对着电脑吼一声,自动打开浏览器中的默认网站。
+>
+>例如,对着笔记本电脑吼一声“百度”,浏览器自动打开百度首页。
+>
+> 关键字:Speech to Text
+
+
+
+PyAudio是唯一一个用到的外部库,用来录制音频文件,官方的[录音实例](http://people.csail.mit.edu/hubert/pyaudio/#record-example)可以直接拿来使用。
+
+使用 百度语音识别 REST API:
+* [官方文档](http://yuyin.baidu.com/docs/asr/56)
+* [access_token的获取](http://developer.baidu.com/wiki/index.php?title=docs/oauth/client)
+* 注意,“百度”会被识别为“baidu,”,即使返回“百渡”也不回“百度”,遇到相同问题的不要太纠结。
diff --git a/jennydai2011/0000/0000-01-result-wechat_number.jpg b/jennydai2011/0000/0000-01-result-wechat_number.jpg
new file mode 100644
index 00000000..48e1da46
Binary files /dev/null and b/jennydai2011/0000/0000-01-result-wechat_number.jpg differ
diff --git a/jennydai2011/0000/0000-02-result.jpg b/jennydai2011/0000/0000-02-result.jpg
new file mode 100644
index 00000000..12857aa8
Binary files /dev/null and b/jennydai2011/0000/0000-02-result.jpg differ
diff --git a/jennydai2011/0000/0000-02.py b/jennydai2011/0000/0000-02.py
new file mode 100644
index 00000000..2f7f520e
--- /dev/null
+++ b/jennydai2011/0000/0000-02.py
@@ -0,0 +1,19 @@
+#!"C:\Python34\python.exe"
+
+from PIL import Image, ImageDraw, ImageFont
+import sys, os, random
+
+num = str(random.randint(1,99))
+def add_num(img):
+ draw = ImageDraw.Draw(img)
+ myfont = ImageFont.truetype('c:/windows/fonts/Arial.ttf', size=40)
+ fillcolor = "#ff0000"
+ width, height = img.size
+ draw.text((width-40, 0), num, font=myfont, fill=fillcolor)
+ img.save('C:/java/pythonProjects/Learning/YixiaohanDailyTask/0000/0000-02-result.jpg', 'jpeg')
+
+ return 0
+
+if __name__ == '__main__':
+ image = Image.open('C:/java/pythonProjects/Learning/YixiaohanDailyTask/0000/image.jpg')
+ add_num(image)
\ No newline at end of file
diff --git a/jennydai2011/0000/0000.py b/jennydai2011/0000/0000.py
new file mode 100644
index 00000000..e69a6e55
--- /dev/null
+++ b/jennydai2011/0000/0000.py
@@ -0,0 +1,28 @@
+#!"C:\Python34\python.exe"
+#import Image
+from PIL import Image, ImageDraw, ImageFont, ImageFilter
+import sys, os, random
+
+num = str(random.randint(1,99))
+imagePath =os.path.join(sys.path[0], 'wechat.jpg')
+savePath=os.path.join(sys.path[0], '0000-01-result-wechat_number.jpg')
+
+def add_num(im, wDraw, hDraw):
+ font = ImageFont.truetype('arial.ttf', 30)
+ draw = ImageDraw.Draw(im)
+ draw.ellipse(
+ (radioX, radioY, radioX + 30, radioY + 30), fill ='red', outline='red')
+ draw.text((wDraw, hDraw), num, font=font, fill='white')
+ im.save(savePath, 'jpeg')
+
+if __name__ == '__main__':
+ im = Image.open(imagePath)
+ w, h = im.size
+ print('Original image size: %sx%s' %(w,h))
+ wDraw = int(0.8 * w)
+ hDraw = int(0.01 * h)
+ radioX = wDraw
+ radioY = hDraw
+ print('radioX:', radioX)
+ print('radioY:', radioY)
+ add_num(im, wDraw, hDraw)
\ No newline at end of file
diff --git a/jennydai2011/0000/arial.ttf b/jennydai2011/0000/arial.ttf
new file mode 100644
index 00000000..ad7d8eab
Binary files /dev/null and b/jennydai2011/0000/arial.ttf differ
diff --git a/jennydai2011/0000/image.jpg b/jennydai2011/0000/image.jpg
new file mode 100644
index 00000000..61803e7c
Binary files /dev/null and b/jennydai2011/0000/image.jpg differ
diff --git a/jennydai2011/0000/wechat.jpg b/jennydai2011/0000/wechat.jpg
new file mode 100644
index 00000000..12bc5429
Binary files /dev/null and b/jennydai2011/0000/wechat.jpg differ
diff --git a/jessun1990/README.MD b/jessun1990/README.MD
new file mode 100644
index 00000000..55f2d0ee
--- /dev/null
+++ b/jessun1990/README.MD
@@ -0,0 +1,4 @@
+# My Repository
+
+My python-homework is here: [ https://github.com/jessun1990/python-homework ](https://github.com/jessun1990/python-homework)
+
diff --git a/jhgdike/0004/solution.py b/jhgdike/0004/solution.py
new file mode 100644
index 00000000..f794c5b2
--- /dev/null
+++ b/jhgdike/0004/solution.py
@@ -0,0 +1,14 @@
+# coding: utf-8
+
+import re
+from collections import Counter
+
+
+def word_count(txt):
+ word_pattern = r'[a-zA-Z-]+'
+ words = re.findall(word_pattern, txt)
+ return Counter(words).items()
+
+if __name__ == '__main__':
+ txt = open('test.txt', 'r').read().lower()
+ print word_count(txt)
diff --git a/jhgdike/0004/test.txt b/jhgdike/0004/test.txt
new file mode 100644
index 00000000..bdd031c4
--- /dev/null
+++ b/jhgdike/0004/test.txt
@@ -0,0 +1 @@
+Henry was a pen name used by an American writer of short stories. His real name was William Sydney Porter. He was born in North Carolina in 1862. As a young boy he lived an exciting life. He did not go to school for very long, but he managed to teach himself everything he needed to know. When he was about 20 years old, O. Henry went to Texas, where he tried different jobs. He first worked on a newspaper, and then had a job in a bank, when some money went missing from the bank O. Henry was believed to have stolen it. Because of that, he was sent to prison. During the three years in prison, he learned to write short stories. After he got out of prison, he went to New York and continued writing. He wrote mostly about New York and the life of the poor there. People liked his stories, because simple as the tales were, they would finish with a sudden change at the end, to the reader¡¯s surprise.
diff --git a/jiangqideng/.gitignore b/jiangqideng/.gitignore
new file mode 100644
index 00000000..f73806eb
--- /dev/null
+++ b/jiangqideng/.gitignore
@@ -0,0 +1 @@
+.ipynb_checkpoints/
\ No newline at end of file
diff --git "a/jiangqideng/python\347\273\203\344\271\240\351\242\230\345\217\212\347\255\224\346\241\210-\357\274\2100000\351\242\230-0025\351\242\230\357\274\211-html\351\242\204\350\247\210\347\211\210.html" "b/jiangqideng/python\347\273\203\344\271\240\351\242\230\345\217\212\347\255\224\346\241\210-\357\274\2100000\351\242\230-0025\351\242\230\357\274\211-html\351\242\204\350\247\210\347\211\210.html"
new file mode 100644
index 00000000..cbac536a
--- /dev/null
+++ "b/jiangqideng/python\347\273\203\344\271\240\351\242\230\345\217\212\347\255\224\346\241\210-\357\274\2100000\351\242\230-0025\351\242\230\357\274\211-html\351\242\204\350\247\210\347\211\210.html"
@@ -0,0 +1,16493 @@
+
+
+
+python练习题及答案-(0000题-0025题)-ipython-notebook版本
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/lwh/23MessageBoard/app/templates/index.html b/lwh/23MessageBoard/app/templates/index.html
new file mode 100644
index 00000000..d12df5d6
--- /dev/null
+++ b/lwh/23MessageBoard/app/templates/index.html
@@ -0,0 +1,15 @@
+{% extends 'base.html' %}
+{% block title %}
+给lwh的留言板
+{% endblock %}
+{% block content %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/lwh/23MessageBoard/app/views.py b/lwh/23MessageBoard/app/views.py
new file mode 100644
index 00000000..0f9ca6b3
--- /dev/null
+++ b/lwh/23MessageBoard/app/views.py
@@ -0,0 +1,10 @@
+from app import app
+from flask import render_template
+
+@app.route('/')
+def index():
+ return render_template('index.html')
+
+@app.route('/postmessage',methods=["POST",])
+def postMessage():
+ return render_template('handlemessage.html')
\ No newline at end of file
diff --git a/lwh/23MessageBoard/run.py b/lwh/23MessageBoard/run.py
new file mode 100644
index 00000000..e217d7f5
--- /dev/null
+++ b/lwh/23MessageBoard/run.py
@@ -0,0 +1,4 @@
+from app import app
+
+if __name__ == '__main__':
+ app.run(debug=True,port=5000)
\ No newline at end of file
diff --git a/lwh/4/test_doc.txt b/lwh/4/test_doc.txt
new file mode 100644
index 00000000..1062fa01
--- /dev/null
+++ b/lwh/4/test_doc.txt
@@ -0,0 +1,57 @@
+Stanford Report, June 14, 2005
+
+Youve got to find what you love, Jobs says
+
+This is the text of the Commencement address by Steve Jobs, CEO of Apple Computer and of Pixar Animation Studios, delivered on June 12, 2005.
+
+I am honored to be with you today at your commencement from one of the finest universities in the world. I never graduated from college. Truth be told, this is the closest Ive ever gotten to a college graduation. Today I want to tell you three stories from my life. Thats it. No big deal. Just three stories.
+
+The first story is about connecting the dots.
+
+I dropped out of Reed College after the first 6 months, but then stayed around as a drop-in for another 18 months or so before I really quit. So why did I drop out?
+
+It started before I was born. My biological mother was a young, unwed college graduate student, and she decided to put me up for adoption. She felt very strongly that I should be adopted by college graduates, so everything was all set for me to be adopted at birth by a lawyer and his wife. Except that when I popped out they decided at the last minute that they really wanted a girl. So my parents, who were on a waiting list, got a call in the middle of the night asking: We have an unexpected baby boy; do you want him? They said: Of course. My biological mother later found out that my mother had never graduated from college and that my father had never graduated from high school. She refused to sign the final adoption papers. She only relented a few months later when my parents promised that I would someday go to college.
+
+And 17 years later I did go to college. But I naively chose a college that was almost as expensive as Stanford, and all of my working-class parents savings were being spent on my college tuition. After six months, I couldnt see the value in it. I had no idea what I wanted to do with my life and no idea how college was going to help me figure it out. And here I was spending all of the money my parents had saved their entire life. So I decided to drop out and trust that it would all work out OK. It was pretty scary at the time, but looking back it was one of the best decisions I ever made. The minute I dropped out I could stop taking the required classes that didnt interest me, and begin dropping in on the ones that looked interesting.
+
+It wasnt all romantic. I didnt have a dorm room, so I slept on the floor in friends rooms, I returned coke bottles for the 5?? deposits to buy food with, and I would walk the 7 miles across town every Sunday night to get one good meal a week at the Hare Krishna temple. I loved it. And much of what I stumbled into by following my curiosity and intuition turned out to be priceless later on. Let me give you one example:
+
+Reed College at that time offered perhaps the best calligraphy instruction in the country. Throughout the campus every poster, every label on every drawer, was beautifully hand calligraphed. Because I had dropped out and didnt have to take the normal classes, I decided to take a calligraphy class to learn how to do this. I learned about serif and san serif typefaces, about varying the amount of space between different letter combinations, about what makes great typography great. It was beautiful, historical, artistically subtle in a way that science cant capture, and I found it fascinating.
+
+None of this had even a hope of any practical application in my life. But ten years later, when we were designing the first Macintosh computer, it all came back to me. And we designed it all into the Mac. It was the first computer with beautiful typography. If I had never dropped in on that single course in college, the Mac would have never had multiple typefaces or proportionally spaced fonts. And since Windows just copied the Mac, its likely that no personal computer would have them. If I had never dropped out, I would have never dropped in on this calligraphy class, and personal computers might not have the wonderful typography that they do. Of course it was impossible to connect the dots looking forward when I was in college. But it was very, very clear looking backwards ten years later.
+
+Again, you cant connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future. You have to trust in something C your gut, destiny, life, karma, whatever. This approach has never let me down, and it has made all the difference in my life.
+
+My second story is about love and loss.
+
+I was lucky C I found what I loved to do early in life. Woz and I started Apple in my parents garage when I was 20. We worked hard, and in 10 years Apple had grown from just the two of us in a garage into a $2 billion company with over 4000 employees. We had just released our finest creation C the Macintosh C a year earlier, and I had just turned 30. And then I got fired. How can you get fired from a company you started? Well, as Apple grew we hired someone who I thought was very talented to run the company with me, and for the first year or so things went well. But then our visions of the future began to diverge and eventually we had a falling out. When we did, our Board of Directors sided with him. So at 30 I was out. And very publicly out. What had been the focus of my entire adult life was gone, and it was devastating.
+
+I really didnt know what to do for a few months. I felt that I had let the previous generation of entrepreneurs down C that I had dropped the baton as it was being passed to me. I met with David Packard and Bob Noyce and tried to apologize for screwing up so badly. I was a very public failure, and I even thought about running away from the valley. But something slowly began to dawn on me C I still loved what I did. The turn of events at Apple had not changed that one bit. I had been rejected, but I was still in love. And so I decided to start over.
+
+I didnt see it then, but it turned out that getting fired from Apple was the best thing that could have ever happened to me. The heaviness of being successful was replaced by the lightness of being a beginner again, less sure about everything. It freed me to enter one of the most creative periods of my life.
+
+During the next five years, I started a company named NeXT, another company named Pixar, and fell in love with an amazing woman who would become my wife. Pixar went on to create the worlds first computer animated feature film, Toy Story, and is now the most successful animation studio in the world. In a remarkable turn of events, Apple bought NeXT, I retuned to Apple, and the technology we developed at NeXT is at the heart of Apples current renaissance. And Laurene and I have a wonderful family together.
+
+Im pretty sure none of this would have happened if I hadnt been fired from Apple. It was awful tasting medicine, but I guess the patient needed it. Sometimes life hits you in the head with a brick. Dont lose faith. Im convinced that the only thing that kept me going was that I loved what I did. Youve got to find what you love. And that is as true for your work as it is for your lovers. Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you havent found it yet, keep looking. Dont settle. As with all matters of the heart, youll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Dont settle.
+
+My third story is about death.
+
+When I was 17, I read a quote that went something like: If you live each day as if it was your last, someday youll most certainly be right. It made an impression on me, and since then, for the past 33 years, I have looked in the mirror every morning and asked myself: If today were the last day of my life, would I want to do what I am about to do today? And whenever the answer has been No for too many days in a row, I know I need to change something.
+
+Remembering that Ill be dead soon is the most important tool Ive ever encountered to help me make the big choices in life. Because almost everything C all external expectations, all pride, all fear of embarrassment or failure C these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart.
+
+About a year ago I was diagnosed with cancer. I had a scan at 7:30 in the morning, and it clearly showed a tumor on my pancreas. I didnt even know what a pancreas was. The doctors told me this was almost certainly a type of cancer that is incurable, and that I should expect to live no longer than three to six months. My doctor advised me to go home and get my affairs in order, which is doctors code for prepare to die. It means to try to tell your kids everything you thought youd have the next 10 years to tell them in just a few months. It means to make sure everything is buttoned up so that it will be as easy as possible for your family. It means to say your goodbyes.
+
+I lived with that diagnosis all day. Later that evening I had a biopsy, where they stuck an endoscope down my throat, through my stomach and into my intestines, put a needle into my pancreas and got a few cells from the tumor. I was sedated, but my wife, who was there, told me that when they viewed the cells under a microscope the doctors started crying because it turned out to be a very rare form of pancreatic cancer that is curable with surgery. I had the surgery and Im fine now.
+
+This was the closest Ive been to facing death, and I hope its the closest I get for a few more decades. Having lived through it, I can now say this to you with a bit more certainty than when death was a useful but purely intellectual concept:
+
+No one wants to die. Even people who want to go to heaven dont want to die to get there. And yet death is the destination we all share. No one has ever escaped it. And that is as it should be, because Death is very likely the single best invention of Life. It is Lifes change agent. It clears out the old to make way for the new. Right now the new is you, but someday not too long from now, you will gradually become the old and be cleared away. Sorry to be so dramatic, but it is quite true.
+
+Your time is limited, so dont waste it living someone elses life. Dont be trapped by dogma C which is living with the results of other peoples thinking. Dont let the noise of others opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.
+
+When I was young, there was an amazing publication called The Whole Earth Catalog, which was one of the bibles of my generation. It was created by a fellow named Stewart Brand not far from here in Menlo Park, and he brought it to life with his poetic touch. This was in the late 1960s, before personal computers and desktop publishing, so it was all made with typewriters, scissors, and polaroid cameras. It was sort of like Google in paperback form, 35 years before Google came along: it was idealistic, and overflowing with neat tools and great notions.
+
+Stewart and his team put out several issues of The Whole Earth Catalog, and then when it had run its course, they put out a final issue. It was the mid-1970s, and I was your age. On the back cover of their final issue was a photograph of an early morning country road, the kind you might find yourself hitchhiking on if you were so adventurous. Beneath it were the words: Stay Hungry. Stay Foolish. It was their farewell message as they signed off. Stay Hungry. Stay Foolish. And I have always wished that for myself. And now, as you graduate to begin anew, I wish that for you.
+
+Stay Hungry. Stay Foolish.
\ No newline at end of file
diff --git a/lwh/4/word_counter.py b/lwh/4/word_counter.py
new file mode 100644
index 00000000..5d3c539c
--- /dev/null
+++ b/lwh/4/word_counter.py
@@ -0,0 +1,19 @@
+import re
+#import collections.Counter
+from collections import Counter
+
+with open("test_doc.txt", "r") as file_obj:
+
+ cont = file_obj.read()
+
+ # 正则匹配精准度更高.使用切片会出现无法切换行符的情况
+ re_cont = re.compile(r"[a-zA-Z]+")
+ word_cont = re_cont.findall(cont)
+ cnt = Counter(word_cont)
+ print(cnt.most_common())
+
+ while True:
+ s = input("enter the key")
+ if s == "":
+ break
+ print(word_dict[s])
diff --git a/lwh/6/import_word.py b/lwh/6/import_word.py
new file mode 100644
index 00000000..7ba5d09a
--- /dev/null
+++ b/lwh/6/import_word.py
@@ -0,0 +1,17 @@
+import os
+import re
+from collections import Counter
+from os.path import join, getsize
+
+root_dir = os.getcwd() + "\\myrecord"
+
+
+for root, dirs, files in os.walk(root_dir):
+ for i in files:
+ with open(root_dir + "\\" + i, "r") as f:
+ cont = f.read()
+ # print(cont)
+ re_cont = re.compile(r"[a-zA-Z]+")
+ word_cont = re_cont.findall(cont)
+ cnt = Counter(word_cont)
+ print(cnt.most_common(1))
diff --git a/lwh/6/myrecord/BillGate.txt b/lwh/6/myrecord/BillGate.txt
new file mode 100644
index 00000000..8db0910c
--- /dev/null
+++ b/lwh/6/myrecord/BillGate.txt
@@ -0,0 +1,142 @@
+President Bok, former President Rudenstine, incoming President Faust, members of the Harvard Corporation and the Board of Overseers, members of the faculty, parents, and especially, the graduates:
+
+Ive been waiting more than 30 years to say this: Dad, I always told you Id come back and get my degree.
+
+I want to thank Harvard for this timely honor. Ill be changing my job next year and it will be nice to finally have a college degree on my resume.
+
+I applaud the graduates today for taking a much more direct route to your degrees. For my part, Im just happy that the Crimson has called me Harvards most successful dropout. I guess that makes me valedictorian of my own special class I did the best of everyone who failed.
+
+But I also want to be recognized as the guy who got Steve Ballmer to drop out of business school. Im a bad influence. Thats why I was invited to speak at your graduation. If I had spoken at your orientation, fewer of you might be here today.
+
+Harvard was just a phenomenal experience for me. Academic life was fascinating. I used to sit in on lots of classes I hadnt even signed up for. And dorm life was terrific. I lived up at Radcliffe, in Currier House. There were always lots of people in my dorm room late at night discussing things, because everyone knew I didnt worry about getting up in the morning. Thats how I came to be the leader of the anti-social group. We clung to each other as a way of validating our rejection of all those social people.
+
+Radcliffe was a great place to live. There were more women up there, and most of the guys were science-math types. That combination offered me the best odds, if you know what I mean. This is where I learned the sad lesson that improving your odds doesnt guarantee success.
+
+One of my biggest memories of Harvard came in January 1975, when I made a call from Currier House to a company in Albuquerque that had begun making the worlds first personal computers. I offered to sell them software.
+
+I worried that they would realize I was just a student in a dorm and hang up on me. Instead they said: Were not quite ready, come see us in a month, which was a good thing, because we hadnt written the software yet. From that moment, I worked day and night on this little extra credit project that marked the end of my college education and the beginning of a remarkable journey with Microsoft.
+
+What I remember above all about Harvard was being in the midst of so much energy and intelligence. It could be exhilarating, intimidating, sometimes even discouraging, but always challenging. It was an amazing privilege C and though I left early, I was transformed by my years at Harvard, the friendships I made, and the ideas I worked on.
+
+But taking a serious look back I do have one big regret.
+
+I left Harvard with no real awareness of the awful inequities in the world C the appalling disparities of health, and wealth, and opportunity that condemn millions of people to lives of despair.
+
+I learned a lot here at Harvard about new ideas in economics and politics. I got great exposure to the advances being made in the sciences.
+
+But humanitys greatest advances are not in its discoveries C but in how those discoveries are applied to reduce inequity. Whether through democracy, strong public education, quality health care, or broad economic opportunity C reducing inequity is the highest human achievement.
+
+I left campus knowing little about the millions of young people cheated out of educational opportunities here in this country. And I knew nothing about the millions of people living in unspeakable poverty and disease in developing countries.
+
+It took me decades to find out.
+
+You graduates came to Harvard at a different time. You know more about the worlds inequities than the classes that came before. In your years here, I hope youve had a chance to think about how C in this age of accelerating technology C we can finally take on these inequities, and we can solve them.
+
+Imagine, just for the sake of discussion, that you had a few hours a week and a few dollars a month to donate to a cause C and you wanted to spend that time and money where it would have the greatest impact in saving and improving lives. Where would you spend it?
+
+For Melinda and for me, the challenge is the same: how can we do the most good for the greatest number with the resources we have.
+
+During our discussions on this question, Melinda and I read an article about the millions of children who were dying every year in poor countries from diseases that we had long ago made harmless in this country. Measles, malaria, pneumonia, hepatitis B, yellow fever. One disease I had never even heard of, rotavirus, was killing half a million kids each year C none of them in the United States.
+
+We were shocked. We had just assumed that if millions of children were dying and they could be saved, the world would make it a priority to discover and deliver the medicines to save them. But it did not. For under a dollar, there were interventions that could save lives that just werent being delivered.
+
+If you believe that every life has equal value, its revolting to learn that some lives are seen as worth saving and others are not. We said to ourselves: This cant be true. But if it is true, it deserves to be the priority of our giving.
+
+So we began our work in the same way anyone here would begin it. We asked: How could the world let these children die?
+
+The answer is simple, and harsh. The market did not reward saving the lives of these children, and governments did not subsidize it. So the children died because their mothers and their fathers had no power in the market and no voice in the system.
+
+But you and I have both.
+
+We can make market forces work better for the poor if we can develop a more creative capitalism C if we can stretch the reach of market forces so that more people can make a profit, or at least make a living, serving people who are suffering from the worst inequities. We also can press governments around the world to spend taxpayer money in ways that better reflect the values of the people who pay the taxes.
+
+If we can find approaches that meet the needs of the poor in ways that generate profits for business and votes for politicians, we will have found a sustainable way to reduce inequity in the world.
+This task is open-ended. It can never be finished. But a conscious effort to answer this challenge will change the world.
+
+I am optimistic that we can do this, but I talk to skeptics who claim there is no hope. They say: Inequity has been with us since the beginning, and will be with us till the end C because people just dont care.
+I completely disagree.
+
+I believe we have more caring than we know what to do with.
+
+All of us here in this Yard, at one time or another, have seen human tragedies that broke our hearts, and yet we did nothing C not because we didnt care, but because we didnt know what to do. If we had known how to help, we would have acted.
+
+The barrier to change is not too little caring; it is too much complexity.
+
+To turn caring into action, we need to see a problem, see a solution, and see the impact. But complexity blocks all three steps.
+
+Even with the advent of the Internet and 24-hour news, it is still a complex enterprise to get people to truly see the problems. When an airplane crashes, officials immediately call a press conference. They promise to investigate, determine the cause, and prevent similar crashes in the future.
+
+But if the officials were brutally honest, they would say: Of all the people in the world who died today from preventable causes, one half of one percent of them were on this plane. Were determined to do everything possible to solve the problem that took the lives of the one half of one percent.
+
+The bigger problem is not the plane crash, but the millions of preventable deaths.
+
+We dont read much about these deaths. The media covers whats new C and millions of people dying is nothing new. So it stays in the background, where its easier to ignore. But even when we do see it or read about it, its difficult to keep our eyes on the problem. Its hard to look at suffering if the situation is so complex that we dont know how to help. And so we look away.
+
+If we can really see a problem, which is the first step, we come to the second step: cutting through the complexity to find a solution.
+
+Finding solutions is essential if we want to make the most of our caring. If we have clear and proven answers anytime an organization or individual asks How can I help?, then we can get action C and we can make sure that none of the caring in the world is wasted. But complexity makes it hard to mark a path of action for everyone who cares and that makes it hard for their caring to matter.
+
+Cutting through complexity to find a solution runs through four predictable stages: determine a goal, find the highest-leverage approach, discover the ideal technology for that approach, and in the meantime, make the smartest application of the technology that you already have whether its something sophisticated, like a drug, or something simpler, like a bednet.
+
+The AIDS epidemic offers an example. The broad goal, of course, is to end the disease. The highest-leverage approach is prevention. The ideal technology would be a vaccine that gives lifetime immunity with a single dose. So governments, drug companies, and foundations fund vaccine research. But their work is likely to take more than a decade, so in the meantime, we have to work with what we have in hand C and the best prevention approach we have now is getting people to avoid risky behavior.
+
+Pursuing that goal starts the four-step cycle again. This is the pattern. The crucial thing is to never stop thinking and working C and never do what we did with malaria and tuberculosis in the 20th century C which is to surrender to complexity and quit.
+
+The final step C after seeing the problem and finding an approach C is to measure the impact of your work and share your successes and failures so that others learn from your efforts.
+
+You have to have the statistics, of course. You have to be able to show that a program is vaccinating millions more children. You have to be able to show a decline in the number of children dying from these diseases. This is essential not just to improve the program, but also to help draw more investment from business and government.
+
+But if you want to inspire people to participate, you have to show more than numbers; you have to convey the human impact of the work C so people can feel what saving a life means to the families affected.
+
+I remember going to Davos some years back and sitting on a global health panel that was discussing ways to save millions of lives. Millions! Think of the thrill of saving just one persons life C then multiply that by millions. Yet this was the most boring panel Ive ever been on C ever. So boring even I couldnt bear it.
+
+What made that experience especially striking was that I had just come from an event where we were introducing version 13 of some piece of software, and we had people jumping and shouting with excitement. I love getting people excited about software C but why cant we generate even more excitement for saving lives?
+
+You cant get people excited unless you can help them see and feel the impact. And how you do that C is a complex question.
+
+Still, Im optimistic. Yes, inequity has been with us forever, but the new tools we have to cut through complexity have not been with us forever. They are new C they can help us make the most of our caring C and thats why the future can be different from the past.
+
+The defining and ongoing innovations of this age C biotechnology, the computer, the Internet C give us a chance weve never had before to end extreme poverty and end death from preventable disease.
+
+Sixty years ago, George Marshall came to this commencement and announced a plan to assist the nations of post-war Europe. He said: I think one difficulty is that the problem is one of such enormous complexity that the very mass of facts presented to the public by press and radio make it exceedingly difficult for the man in the street to reach a clear appraisement of the situation. It is virtually impossible at this distance to grasp at all the real significance of the situation.
+
+Thirty years after Marshall made his address, as my class graduated without me, technology was emerging that would make the world smaller, more open, more visible, less distant.
+
+The emergence of low-cost personal computers gave rise to a powerful network that has transformed opportunities for learning and communicating.
+
+The magical thing about this network is not just that it collapses distance and makes everyone your neighbor. It also dramatically increases the number of brilliant minds we can have working together on the same problem C and that scales up the rate of innovation to a staggering degree.
+
+At the same time, for every person in the world who has access to this technology, five people dont. That means many creative minds are left out of this discussion smart people with practical intelligence and relevant experience who dont have the technology to hone their talents or contribute their ideas to the world.
+
+We need as many people as possible to have access to this technology, because these advances are triggering a revolution in what human beings can do for one another. They are making it possible not just for national governments, but for universities, corporations, smaller organizations, and even individuals to see problems, see approaches, and measure the impact of their efforts to address the hunger, poverty, and desperation George Marshall spoke of 60 years ago.
+
+Members of the Harvard Family: Here in the Yard is one of the great collections of intellectual talent in the world.
+
+What for?
+
+There is no question that the faculty, the alumni, the students, and the benefactors of Harvard have used their power to improve the lives of people here and around the world. But can we do more? Can Harvard dedicate its intellect to improving the lives of people who will never even hear its name?
+
+Let me make a request of the deans and the professors C the intellectual leaders here at Harvard: As you hire new faculty, award tenure, review curriculum, and determine degree requirements, please ask yourselves:
+
+Should our best minds be dedicated to solving our biggest problems?
+
+Should Harvard encourage its faculty to take on the worlds worst inequities? Should Harvard students learn about the depth of global poverty the prevalence of world hunger the scarcity of clean water the girls kept out of school the children who die from diseases we can cure?
+
+Should the worlds most privileged people learn about the lives of the worlds least privileged?
+
+These are not rhetorical questions C you will answer with your policies.
+
+My mother, who was filled with pride the day I was admitted here C never stopped pressing me to do more for others. A few days before my wedding, she hosted a bridal event, at which she read aloud a letter about marriage that she had written to Melinda. My mother was very ill with cancer at the time, but she saw one more opportunity to deliver her message, and at the close of the letter she said: From those to whom much is given, much is expected.
+
+When you consider what those of us here in this Yard have been given C in talent, privilege, and opportunity C there is almost no limit to what the world has a right to expect from us.
+
+In line with the promise of this age, I want to exhort each of the graduates here to take on an issue C a complex problem, a deep inequity, and become a specialist on it. If you make it the focus of your career, that would be phenomenal. But you dont have to do that to make an impact. For a few hours every week, you can use the growing power of the Internet to get informed, find others with the same interests, see the barriers, and find ways to cut through them.
+
+Dont let complexity stop you. Be activists. Take on the big inequities. It will be one of the great experiences of your lives.
+
+You graduates are coming of age in an amazing time. As you leave Harvard, you have technology that members of my class never had. You have awareness of global inequity, which we did not have. And with that awareness, you likely also have an informed conscience that will torment you if you abandon these people whose lives you could change with very little effort.
+You have more than we had; you must start sooner, and carry on longer.
+
+Knowing what you know, how could you not?
+
+And I hope you will come back here to Harvard 30 years from now and reflect on what you have done with your talent and your energy. I hope you will judge yourselves not on your professional accomplishments alone, but also on how well you have addressed the worlds deepest inequities on how well you treated people a world away who have nothing in common with you but their humanity.
\ No newline at end of file
diff --git a/lwh/6/myrecord/SteveJob.txt b/lwh/6/myrecord/SteveJob.txt
new file mode 100644
index 00000000..1062fa01
--- /dev/null
+++ b/lwh/6/myrecord/SteveJob.txt
@@ -0,0 +1,57 @@
+Stanford Report, June 14, 2005
+
+Youve got to find what you love, Jobs says
+
+This is the text of the Commencement address by Steve Jobs, CEO of Apple Computer and of Pixar Animation Studios, delivered on June 12, 2005.
+
+I am honored to be with you today at your commencement from one of the finest universities in the world. I never graduated from college. Truth be told, this is the closest Ive ever gotten to a college graduation. Today I want to tell you three stories from my life. Thats it. No big deal. Just three stories.
+
+The first story is about connecting the dots.
+
+I dropped out of Reed College after the first 6 months, but then stayed around as a drop-in for another 18 months or so before I really quit. So why did I drop out?
+
+It started before I was born. My biological mother was a young, unwed college graduate student, and she decided to put me up for adoption. She felt very strongly that I should be adopted by college graduates, so everything was all set for me to be adopted at birth by a lawyer and his wife. Except that when I popped out they decided at the last minute that they really wanted a girl. So my parents, who were on a waiting list, got a call in the middle of the night asking: We have an unexpected baby boy; do you want him? They said: Of course. My biological mother later found out that my mother had never graduated from college and that my father had never graduated from high school. She refused to sign the final adoption papers. She only relented a few months later when my parents promised that I would someday go to college.
+
+And 17 years later I did go to college. But I naively chose a college that was almost as expensive as Stanford, and all of my working-class parents savings were being spent on my college tuition. After six months, I couldnt see the value in it. I had no idea what I wanted to do with my life and no idea how college was going to help me figure it out. And here I was spending all of the money my parents had saved their entire life. So I decided to drop out and trust that it would all work out OK. It was pretty scary at the time, but looking back it was one of the best decisions I ever made. The minute I dropped out I could stop taking the required classes that didnt interest me, and begin dropping in on the ones that looked interesting.
+
+It wasnt all romantic. I didnt have a dorm room, so I slept on the floor in friends rooms, I returned coke bottles for the 5?? deposits to buy food with, and I would walk the 7 miles across town every Sunday night to get one good meal a week at the Hare Krishna temple. I loved it. And much of what I stumbled into by following my curiosity and intuition turned out to be priceless later on. Let me give you one example:
+
+Reed College at that time offered perhaps the best calligraphy instruction in the country. Throughout the campus every poster, every label on every drawer, was beautifully hand calligraphed. Because I had dropped out and didnt have to take the normal classes, I decided to take a calligraphy class to learn how to do this. I learned about serif and san serif typefaces, about varying the amount of space between different letter combinations, about what makes great typography great. It was beautiful, historical, artistically subtle in a way that science cant capture, and I found it fascinating.
+
+None of this had even a hope of any practical application in my life. But ten years later, when we were designing the first Macintosh computer, it all came back to me. And we designed it all into the Mac. It was the first computer with beautiful typography. If I had never dropped in on that single course in college, the Mac would have never had multiple typefaces or proportionally spaced fonts. And since Windows just copied the Mac, its likely that no personal computer would have them. If I had never dropped out, I would have never dropped in on this calligraphy class, and personal computers might not have the wonderful typography that they do. Of course it was impossible to connect the dots looking forward when I was in college. But it was very, very clear looking backwards ten years later.
+
+Again, you cant connect the dots looking forward; you can only connect them looking backwards. So you have to trust that the dots will somehow connect in your future. You have to trust in something C your gut, destiny, life, karma, whatever. This approach has never let me down, and it has made all the difference in my life.
+
+My second story is about love and loss.
+
+I was lucky C I found what I loved to do early in life. Woz and I started Apple in my parents garage when I was 20. We worked hard, and in 10 years Apple had grown from just the two of us in a garage into a $2 billion company with over 4000 employees. We had just released our finest creation C the Macintosh C a year earlier, and I had just turned 30. And then I got fired. How can you get fired from a company you started? Well, as Apple grew we hired someone who I thought was very talented to run the company with me, and for the first year or so things went well. But then our visions of the future began to diverge and eventually we had a falling out. When we did, our Board of Directors sided with him. So at 30 I was out. And very publicly out. What had been the focus of my entire adult life was gone, and it was devastating.
+
+I really didnt know what to do for a few months. I felt that I had let the previous generation of entrepreneurs down C that I had dropped the baton as it was being passed to me. I met with David Packard and Bob Noyce and tried to apologize for screwing up so badly. I was a very public failure, and I even thought about running away from the valley. But something slowly began to dawn on me C I still loved what I did. The turn of events at Apple had not changed that one bit. I had been rejected, but I was still in love. And so I decided to start over.
+
+I didnt see it then, but it turned out that getting fired from Apple was the best thing that could have ever happened to me. The heaviness of being successful was replaced by the lightness of being a beginner again, less sure about everything. It freed me to enter one of the most creative periods of my life.
+
+During the next five years, I started a company named NeXT, another company named Pixar, and fell in love with an amazing woman who would become my wife. Pixar went on to create the worlds first computer animated feature film, Toy Story, and is now the most successful animation studio in the world. In a remarkable turn of events, Apple bought NeXT, I retuned to Apple, and the technology we developed at NeXT is at the heart of Apples current renaissance. And Laurene and I have a wonderful family together.
+
+Im pretty sure none of this would have happened if I hadnt been fired from Apple. It was awful tasting medicine, but I guess the patient needed it. Sometimes life hits you in the head with a brick. Dont lose faith. Im convinced that the only thing that kept me going was that I loved what I did. Youve got to find what you love. And that is as true for your work as it is for your lovers. Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you havent found it yet, keep looking. Dont settle. As with all matters of the heart, youll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Dont settle.
+
+My third story is about death.
+
+When I was 17, I read a quote that went something like: If you live each day as if it was your last, someday youll most certainly be right. It made an impression on me, and since then, for the past 33 years, I have looked in the mirror every morning and asked myself: If today were the last day of my life, would I want to do what I am about to do today? And whenever the answer has been No for too many days in a row, I know I need to change something.
+
+Remembering that Ill be dead soon is the most important tool Ive ever encountered to help me make the big choices in life. Because almost everything C all external expectations, all pride, all fear of embarrassment or failure C these things just fall away in the face of death, leaving only what is truly important. Remembering that you are going to die is the best way I know to avoid the trap of thinking you have something to lose. You are already naked. There is no reason not to follow your heart.
+
+About a year ago I was diagnosed with cancer. I had a scan at 7:30 in the morning, and it clearly showed a tumor on my pancreas. I didnt even know what a pancreas was. The doctors told me this was almost certainly a type of cancer that is incurable, and that I should expect to live no longer than three to six months. My doctor advised me to go home and get my affairs in order, which is doctors code for prepare to die. It means to try to tell your kids everything you thought youd have the next 10 years to tell them in just a few months. It means to make sure everything is buttoned up so that it will be as easy as possible for your family. It means to say your goodbyes.
+
+I lived with that diagnosis all day. Later that evening I had a biopsy, where they stuck an endoscope down my throat, through my stomach and into my intestines, put a needle into my pancreas and got a few cells from the tumor. I was sedated, but my wife, who was there, told me that when they viewed the cells under a microscope the doctors started crying because it turned out to be a very rare form of pancreatic cancer that is curable with surgery. I had the surgery and Im fine now.
+
+This was the closest Ive been to facing death, and I hope its the closest I get for a few more decades. Having lived through it, I can now say this to you with a bit more certainty than when death was a useful but purely intellectual concept:
+
+No one wants to die. Even people who want to go to heaven dont want to die to get there. And yet death is the destination we all share. No one has ever escaped it. And that is as it should be, because Death is very likely the single best invention of Life. It is Lifes change agent. It clears out the old to make way for the new. Right now the new is you, but someday not too long from now, you will gradually become the old and be cleared away. Sorry to be so dramatic, but it is quite true.
+
+Your time is limited, so dont waste it living someone elses life. Dont be trapped by dogma C which is living with the results of other peoples thinking. Dont let the noise of others opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.
+
+When I was young, there was an amazing publication called The Whole Earth Catalog, which was one of the bibles of my generation. It was created by a fellow named Stewart Brand not far from here in Menlo Park, and he brought it to life with his poetic touch. This was in the late 1960s, before personal computers and desktop publishing, so it was all made with typewriters, scissors, and polaroid cameras. It was sort of like Google in paperback form, 35 years before Google came along: it was idealistic, and overflowing with neat tools and great notions.
+
+Stewart and his team put out several issues of The Whole Earth Catalog, and then when it had run its course, they put out a final issue. It was the mid-1970s, and I was your age. On the back cover of their final issue was a photograph of an early morning country road, the kind you might find yourself hitchhiking on if you were so adventurous. Beneath it were the words: Stay Hungry. Stay Foolish. It was their farewell message as they signed off. Stay Hungry. Stay Foolish. And I have always wished that for myself. And now, as you graduate to begin anew, I wish that for you.
+
+Stay Hungry. Stay Foolish.
\ No newline at end of file
diff --git a/lwh/6/myrecord/exp.txt b/lwh/6/myrecord/exp.txt
new file mode 100644
index 00000000..912b6d3c
--- /dev/null
+++ b/lwh/6/myrecord/exp.txt
@@ -0,0 +1,23 @@
+This course will be beneficial if you wish to learn how to communicate with the sounds and music of American English. The purpose is not to increase your vocabulary, nor to improve your grammar, but to deal with the sounds of the words that you speak. Your message is of primary importance, but it may not be understood if your pronunciation is imprecise, inconsistent, or regional. This course is particularly useful for actors or for others who need to speak to diverse audiences, such as when giving a business presentation.
+
+You will have the flexibility of time to experience, at your own pace, aural and visual aspects of a sound. Within the course, students are assessed on their ability to recognize each sound in a variety of contexts and are given feedback on their particular answers.
+
+You will learn to:
+
+Articulate sounds and words using the dialect of Standard American English.
+Listen and think in terms of symbols for sounds, using the International Phonetic Alphabet.
+Use the International Phonetic Alphabet to transcribe from the Roman alphabet into the forty-four sounds of Standard American Dialect and vice versa.
+Analyze texts for phrasing, operative words, intonational patterns, degrees of stress.
+Achieve a proper use of weak forms for certain parts of speech in the English Language, making your speech clear and efficient.
+Additional Course Details
+Topics Covered: Foundations of Speech, Intonational Patterning of American English, Vowels, Dipthongs, Consonants (coming soon), Weak Forms. Additional Software or Materials Required: You will need to have Flash and Quicktime installed. These programs are free. More detailed information is provided in the course under Test and Configure Your System. Maintenance Fee (per student): Free for both independent learners and academic students.
+In-Depth Description
+In the context of effective speech, Standard American refers to a single standard, devoid of regional influences. Few people in the U.S. grow up speaking Standard American English Dialect; geography plays a major role in the way people speak. An accent or a dialect that could interfere with a clear exchange of ideas with those using a differing dialect or accent.
+
+It is true that there is no official standard, but there is an understood range of acceptability for American English. As a professor of speech for actors, Baker-Shirer aims to teach a manner of speech that communicates the content of words with clarity and consistency.
+
+Standard American is not a judgment of value; none of the numerous American dialects is superior to the others. Instead it is a standard for clear, consistent speech recognizable to listeners across dialects. It does not burden the listener with the extra cognitive load of filtering out regional differences before reaching the meaning or intent of the speaker. Speaking Standard American dialect means speaking English that will sound Americansimple, unaffected and distinct, devoid of regional influences.
+
+This course is divided into six sections or units:
+
+Foundations of Speech This first unit of the course is an overview of some of the basic concepts that will lay a foundation for your study of the Standard American English dialect. These concepts include sound identification, voiced and voiceless sounds, syllabification, and aspiration and unaspiration of the three stop-plosive consonant groups. Intonational Patterning of American English The next unit of this course attends to the music of Standard American English Dialect and is most essential to support and increase meaning. The techniques involved in successful vocal dynamics include: vocal range, tempo, pacing, inflection and pausing. Vowels The vowels unit will introduce you to the pure vowel sounds of the dialect. As the tone carriers, vowels are an important part of your speech, and there is a great deal of subtlety between some of these sounds. Here we will introduce you to the fifteen vowel sounds of the dialect in three categories, front, mid, and back vowels. Diphthongs This unit will build on what you learned in the vowels unit by introducing the ten diphthongs of the dialect. In the Standard American English Dialect there are five so-called long diphthongs and five always short diphthongs of r. Consonants (Coming Soon) This unit introduces the second big component of speech, consonants. These are sounds that interrupt or change the sound coming from the vocal tract. They are described according to vibration, the place and manner of articulation. There are sixteen voiced consonants and ten voiceless consonants in Standard American English Dialect. Weak Forms The weak forms unit will introduce you to the concept of stress in speech. More specifically, weak forms of certain words in the English language exist to increase clarity and understanding while subordinating the inessential. The following parts of speech are usually weakened in continuous speech: articles, conjunctions, auxiliary verbs, personal pronouns and prepositions.
\ No newline at end of file
diff --git a/lwh/7/line_counter.py b/lwh/7/line_counter.py
new file mode 100644
index 00000000..03edf7e8
--- /dev/null
+++ b/lwh/7/line_counter.py
@@ -0,0 +1,58 @@
+"""
+ 有个目录,里面是你自己写过的程序,统计一下你写过多少行代码。
+ 包括空行和注释,但是要分别列出来。
+"""
+# -*- coding:gbk -*-
+import os
+import re
+
+root_dir = os.getcwd() + "/卢炜豪"
+os.chdir(root_dir)
+
+code_count = 0
+note_count = 0
+
+
+def isnote(line):
+ line = line.strip()
+ #print(line, line_count)
+ if len(line) >= 2:
+ # print("***")
+ #print("&&&", line[0], line[1])
+ if line[0] == 47 and line[1] == 47:
+ return "//"
+ elif line[0] == 47 and line[1] == 42:
+ return "/*"
+ else:
+ return "no"
+
+for parent, dirnames, filenames in os.walk(root_dir):
+ #print(parent, filenames)
+ # print(dirname)
+
+ for filename in filenames:
+ os.chdir(parent)
+ # print(filename)
+ # print(parent)
+ with open(filename, "rb") as f:
+ line = f.readline().strip()
+ while line != b"":
+ # print("*")
+ ret = isnote(line)
+ # print(ret)
+ if ret == "//":
+ note_count = note_count + 1
+ elif ret == "/*":
+ line = f.readline().strip()
+ # print(line)
+ # if len(line) >= 2:
+ while b"*/" in line:
+ note_count = note_count + 1
+ line = f.readline().strip()
+ # print(line)
+ elif ret == "no":
+ code_count = code_count + 1
+ line = f.readline().strip()
+
+print("代码行数:%d" % code_count)
+print("注释函数 %d" % note_count)
diff --git a/messyidea/0000/0000.py b/messyidea/0000/0000.py
new file mode 100644
index 00000000..89675ecf
--- /dev/null
+++ b/messyidea/0000/0000.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+import Image, ImageDraw, ImageFont
+
+org = Image.open('./origin.jpg')
+draw = ImageDraw.Draw(org)
+w, h = org.size
+fontsize = min(w, h) / 4
+font = ImageFont.truetype('GenBkBasI.ttf', fontsize)
+draw.text((w - fontsize, 0), '3', font = font, fill = (255, 0, 0))
+org.save('rst.jpg', 'jpeg')
diff --git a/messyidea/0000/GenBkBasI.ttf b/messyidea/0000/GenBkBasI.ttf
new file mode 100644
index 00000000..c62506b1
Binary files /dev/null and b/messyidea/0000/GenBkBasI.ttf differ
diff --git a/messyidea/0000/origin.jpg b/messyidea/0000/origin.jpg
new file mode 100644
index 00000000..9586997f
Binary files /dev/null and b/messyidea/0000/origin.jpg differ
diff --git a/messyidea/0000/rst.jpg b/messyidea/0000/rst.jpg
new file mode 100644
index 00000000..82885a04
Binary files /dev/null and b/messyidea/0000/rst.jpg differ
diff --git a/messyidea/0001/0001.py b/messyidea/0001/0001.py
new file mode 100644
index 00000000..b7202cba
--- /dev/null
+++ b/messyidea/0001/0001.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+import uuid
+
+def gen( num):
+ assert isinstance(num, int) == True
+ assert num > 0
+ rst = []
+ while True:
+ temp = str(uuid.uuid1()).replace('-', '')
+ if temp not in rst:
+ rst.append(temp)
+ num = num - 1
+ if num == 0:
+ break
+ return rst
+
+rst = gen(200)
+for i in rst:
+ print i
diff --git a/messyidea/0002/0002.py b/messyidea/0002/0002.py
new file mode 100644
index 00000000..f5ff2f6a
--- /dev/null
+++ b/messyidea/0002/0002.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+import uuid
+import MySQLdb
+
+def gen( num):
+ assert isinstance(num, int) == True
+ assert num > 0
+ rst = []
+ while True:
+ temp = str(uuid.uuid1()).replace('-', '')
+ if temp not in rst:
+ rst.append(temp)
+ num = num - 1
+ if num == 0:
+ break
+ return rst
+
+rst = gen(200)
+for i in rst:
+ print i
+
+try:
+ conn=MySQLdb.connect(host='localhost',user='root',passwd='root',port=3306)
+ cur=conn.cursor()
+
+ cur.execute('create database if not exists Activation_code')
+ conn.select_db('Activation_code')
+ cur.execute('create table code(id int,uuid varchar(50))')
+
+ for i in range(len(rst)):
+ cur.execute('insert into code values(%s,%s)',(i ,rst[i]))
+
+ conn.commit()
+ cur.close()
+ conn.close()
+
+except MySQLdb.Error,e:
+ print "Mysql Error %d: %s" % (e.args[0], e.args[1])
+
+
diff --git a/messyidea/0003/0003.py b/messyidea/0003/0003.py
new file mode 100644
index 00000000..dd9edec4
--- /dev/null
+++ b/messyidea/0003/0003.py
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+import uuid
+import redis
+
+def gen( num):
+ assert isinstance(num, int) == True
+ assert num > 0
+ rst = []
+ while True:
+ temp = str(uuid.uuid1()).replace('-', '')
+ if temp not in rst:
+ rst.append(temp)
+ num = num - 1
+ if num == 0:
+ break
+ return rst
+
+rst = gen(200)
+
+r = redis.Redis(host='127.0.0.1', port=6379, db=0)
+
+prefix = 'active'
+
+for i in rst:
+ r.set('%s_%s' % (prefix, i), i)
+ print i
+
+show = r.keys('*')
+
+for i in show:
+ print r.get(i)
diff --git a/messyidea/0004/0004.py b/messyidea/0004/0004.py
new file mode 100644
index 00000000..956007ef
--- /dev/null
+++ b/messyidea/0004/0004.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+# coding=utf-8
+
+filename = 'input.txt'
+dict = {}
+f = open(filename, 'r')
+for eachLine in f:
+ temp = eachLine.split()
+ for i in temp:
+ if i not in dict:
+ dict[i] = 1
+ else:
+ dict[i] += 1
+
+#print dict
+for key in dict:
+ print key, dict[key]
diff --git a/messyidea/0004/input.txt b/messyidea/0004/input.txt
new file mode 100644
index 00000000..566f3f17
--- /dev/null
+++ b/messyidea/0004/input.txt
@@ -0,0 +1,3 @@
+a a b sd ad xs c c
+s t ff ss s
+f t ss s
diff --git a/messyidea/0005/0005.py b/messyidea/0005/0005.py
new file mode 100644
index 00000000..e0394d71
--- /dev/null
+++ b/messyidea/0005/0005.py
@@ -0,0 +1,8 @@
+#!/usr/bin/env python
+# coding=utf-8
+
+from PIL import Image
+
+org = Image.open('./origin.jpg')
+org = org.resize((50,50), Image.ANTIALIAS)
+org.save('rst', 'jpeg')
diff --git a/messyidea/0005/origin.jpg b/messyidea/0005/origin.jpg
new file mode 100644
index 00000000..9586997f
Binary files /dev/null and b/messyidea/0005/origin.jpg differ
diff --git a/messyidea/0005/rst b/messyidea/0005/rst
new file mode 100644
index 00000000..381555cc
Binary files /dev/null and b/messyidea/0005/rst differ
diff --git a/mio4kon/0000/0000.py b/mio4kon/0000/0000.py
new file mode 100644
index 00000000..db6f6b2e
--- /dev/null
+++ b/mio4kon/0000/0000.py
@@ -0,0 +1,28 @@
+from PIL import Image, ImageDraw, ImageFont, ImageFilter
+import sys, os, random
+
+num = str(random.randint(1, 99))
+imagePath = os.path.join(sys.path[0], 'mio.jpg')
+savaPath = os.path.join(sys.path[0], 'mio_dot.jpg')
+
+
+def add_num(im, wDraw, hDraw):
+ font = ImageFont.truetype('Arial.ttf', 30)
+ draw = ImageDraw.Draw(im)
+ draw.ellipse(
+ (radioX, radioY, radioX + 30, radioY + 30), fill='red', outline='red')
+ draw.text((wDraw, hDraw), num, font=font, fill='white')
+ im.save(savaPath, 'jpeg')
+
+
+if __name__ == '__main__':
+ im = Image.open(imagePath)
+ w, h = im.size
+ print('Original image size: %sx%s' % (w, h))
+ wDraw = int(0.8 * w)
+ hDraw = int(0.01 * h)
+ radioX = wDraw
+ radioY = hDraw
+ print('radioX:', radioX)
+ print('radioY:', radioY)
+ add_num(im, wDraw, hDraw)
diff --git a/mio4kon/0000/mio.jpg b/mio4kon/0000/mio.jpg
new file mode 100644
index 00000000..e42269f4
Binary files /dev/null and b/mio4kon/0000/mio.jpg differ
diff --git a/mio4kon/0000/mio_dot.jpg b/mio4kon/0000/mio_dot.jpg
new file mode 100644
index 00000000..5fbb5e6a
Binary files /dev/null and b/mio4kon/0000/mio_dot.jpg differ
diff --git a/mio4kon/0010/0010.py b/mio4kon/0010/0010.py
new file mode 100644
index 00000000..6e6904d8
--- /dev/null
+++ b/mio4kon/0010/0010.py
@@ -0,0 +1,35 @@
+
+from PIL import Image, ImageDraw, ImageFont, ImageFilter
+import random
+verificationCode = ['K', 'L', 'K', 'B']
+
+
+def rndColor():
+ return (random.randint(64, 255), random.randint(64, 255),
+ random.randint(64, 255))
+
+
+def rndColor2():
+ return (random.randint(32, 127), random.randint(32, 127),
+ random.randint(32, 127))
+
+
+width = 60 * 4
+height = 60
+image = Image.new('RGB', (width, height), (255, 255, 255))
+font = ImageFont.truetype('Arial.ttf', 36)
+draw = ImageDraw.Draw(image)
+
+# 背景
+for x in range(width):
+ for y in range(height):
+ draw.point((x, y), fill=rndColor())
+
+# 文字
+for k in range(4):
+ draw.text((60 * k + 10, 10), verificationCode[k], font=font, fill=rndColor2())
+
+# 模糊
+
+image = image.filter(ImageFilter.BLUR)
+image.save('code.jpg', 'jpeg')
diff --git a/mio4kon/0010/code.jpg b/mio4kon/0010/code.jpg
new file mode 100644
index 00000000..16108a86
Binary files /dev/null and b/mio4kon/0010/code.jpg differ
diff --git a/monkey/0004/README.md b/monkey/0004/README.md
new file mode 100644
index 00000000..f9aad3fb
--- /dev/null
+++ b/monkey/0004/README.md
@@ -0,0 +1,5 @@
+###题目要求
+任一个英文的纯文本文件,统计其中的单词出现的个数。
+
+###Topic request
+in a English plain text file, you must count the number of every word that appear in it.
\ No newline at end of file
diff --git a/monkey/0004/main.py b/monkey/0004/main.py
new file mode 100644
index 00000000..7aeee03c
--- /dev/null
+++ b/monkey/0004/main.py
@@ -0,0 +1,33 @@
+import re
+
+__author__ = 'monkey'
+
+def countWords():
+ # 打开文件
+ with open('text.txt', 'r') as file:
+ data = file.read()
+
+ words = re.compile(r'([a-zA-Z]+)')
+
+ # 统计每个单词出现个个数
+ dic = {}
+ for i in words.findall(data):
+ if i not in dic:
+ dic[i] = 1
+ else:
+ dic[i] += 1
+
+ # 将字典里面的item保存到list中
+ numlist = []
+ for k,value in dic.items():
+ numlist.append((k, value))
+
+ # 排序
+ numlist.sort(key = lambda t:t[0])
+
+ # 输出结果
+ for i in numlist:
+ print(i[0], i[1])
+
+if __name__ == '__main__':
+ countWords()
\ No newline at end of file
diff --git a/monkey/0004/text.txt b/monkey/0004/text.txt
new file mode 100644
index 00000000..d94aa6db
--- /dev/null
+++ b/monkey/0004/text.txt
@@ -0,0 +1,29 @@
+Most people need to hear those "three little words" I love you. Once in a while, they hear them just in time.
+
+I met Connie the day she was admitted to the hospice ward, where I worked as a volunteer. Her husband, Bill, stood nervously nearby as she was transferred from the gurney to the hospital bed. Although Connie was in the final stages of her fight against cancer, she was alert and cheerful. We got her settled in. I finished marking her name on all the hospital supplies she would be using, then asked if she needed anything.
+
+"Oh, yes," she said, "would you please show me how to use the TV? I enjoy the soaps so much and I don't want to get behind on what's happening." Connie was a romantic. She loved soap operas, romance novels and movies with a good love story. As we became acquainted, she confided how frustrating it was to be married 32 years to a man who often called her "a silly woman."
+
+"Oh, I know Bill loves me," she said, "but he has never been one to say he loves me, or send cards to me." She sighed and looked out the window at the trees in the courtyard. "I'd give anything if he'd say 'I love you,' but it's just not in his nature."
+
+Bill visited Connie every day. In the beginning, he sat next to the bed while she watched the soaps. Later, when she began sleeping more, he paced up and down the hallway outside her room. Soon, when she no longer watched television and had fewer waking moments, I began spending more of my volunteer time with Bill.
+
+He talked about having worked as a carpenter and how he liked to go fishing. He and Connie had no children, but they'd been enjoying retirement by traveling, until Connie got sick. Bill could not express his feelings about the fact that his wife was dying.
+
+One day, over coffee in the cafeteria, I got him on the subject of women and how we need romance in our lives; how we love to get sentimental1 cards and love letters.
+
+"Do you tell Connie you love her?" I asked (knowing his answer), and he looked at me as if I was crazy.
+
+"I don't have to," he said. "She knows I do!"
+
+"I'm sure she knows," I said, reaching over and touching his hands rough, carpenter's hands that were gripping the cup as if it were the only thing he had to hang onto "but she needs to hear it, Bill. She needs to hear what she has meant to you all these years. Please think about it."
+
+We walked back to Connie's room. Bill disappeared inside, and I left to visit another patient. Later, I saw Bill sitting by the bed. He was holding Connie's hand as she slept. The date was February 12.
+
+Two days later I walked down the hospice ward at noon. There stood Bill, leaning up against the wall in the hallway, staring at the floor. I already knew from the head nurse that Connie had died at 11 A.M..
+
+When Bill saw me, he allowed himself to come into my arms for a long time. His face was wet with tears and he was trembling. Finally, he leaned back against the wall and took a deep breath.
+
+"I have to say something," he said. "I have to say how good I feel about telling her." He stopped to blow his nose. "I thought a lot about what you said, and this morning I told her how much I loved her... and loved being married to her. You shoulda2 seen her smile!"
+
+I went into the room to say my own goodbye to Connie. There, on the bedside table, was a large Valentine card from Bill. You know, the sentimental kind that says, "To my wonderful wife... I love you."
\ No newline at end of file
diff --git "a/monkey/0008/The world's leading software development platform \302\267 GitHub.html" "b/monkey/0008/The world's leading software development platform \302\267 GitHub.html"
new file mode 100644
index 00000000..4e6348b9
--- /dev/null
+++ "b/monkey/0008/The world's leading software development platform \302\267 GitHub.html"
@@ -0,0 +1,757 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The world's leading software development platform · GitHub
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GitHub is a development platform inspired by the way you work. From open source to business, you can host and review code, manage projects, and build software alongside millions of other developers.
+
+ Collaboration makes perfect. The conversations and code reviews that happen in Pull Requests help your team share the weight of your work and improve the software you build.
+
+ Take a deep breath. On GitHub, project management happens in Issues and Projects, right alongside your code. All you have to do is mention a teammate to get them involved.
+
+ We worried about your administrative and security needs so you don’t have to. From flexible hosting to authentication options, GitHub can help you meet your team’s requirements.
+
+ Prevent problems before they happen. Protected branches, signed commits, and required status checks protect your work and help you maintain a high standard for your code.
+
+
+
Access controlled
+
+ Encourage teams to work together while limiting access to those who need it with granular permissions and authentication through SAML/SSO and LDAP.
+
+
+
Hosted where you need it
+
+ Securely and reliably host your work on GitHub.com. Or, deploy GitHub Enterprise on your own servers or in a private cloud using Amazon Web Services, Azure or Google Cloud Platform.
+
+
+
+
+
+
+
+
+
+
+
+
+ Integrations
+
+
+ Build on GitHub
+
+
+ Customize your process with GitHub apps and an intuitive API. Integrate the tools you already use or discover new favorites to create a happier, more efficient way of working.
+
+ Get started for free — join the millions of developers already using GitHub to share their code, work together, and build amazing things.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ You can't perform that action at this time.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ You signed in with another tab or window. Reload to refresh your session.
+ You signed out in another tab or window. Reload to refresh your session.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/monkey/0008/main.py b/monkey/0008/main.py
new file mode 100644
index 00000000..08a3aef5
--- /dev/null
+++ b/monkey/0008/main.py
@@ -0,0 +1,27 @@
+# -*- coding:utf-8 -*-
+
+'''
+
+第 0008 题:一个HTML文件,找出里面的正文。
+
+@Author monkey
+@Date 2017-8-31
+'''
+import json
+
+from bs4 import BeautifulSoup
+
+
+def findContent():
+ path = "The world's leading software development platform · GitHub.html"
+
+ with open(path, encoding='UTF-8') as file:
+ soup = BeautifulSoup(file)
+
+ # print(soup.prettify())
+ print(soup.body)
+
+
+
+if __name__ == '__main__':
+ findContent()
\ No newline at end of file
diff --git "a/monkey/0009/The world's leading software development platform \302\267 GitHub.html" "b/monkey/0009/The world's leading software development platform \302\267 GitHub.html"
new file mode 100644
index 00000000..4e6348b9
--- /dev/null
+++ "b/monkey/0009/The world's leading software development platform \302\267 GitHub.html"
@@ -0,0 +1,757 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The world's leading software development platform · GitHub
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ GitHub is a development platform inspired by the way you work. From open source to business, you can host and review code, manage projects, and build software alongside millions of other developers.
+
+ Collaboration makes perfect. The conversations and code reviews that happen in Pull Requests help your team share the weight of your work and improve the software you build.
+
+ Take a deep breath. On GitHub, project management happens in Issues and Projects, right alongside your code. All you have to do is mention a teammate to get them involved.
+
+ We worried about your administrative and security needs so you don’t have to. From flexible hosting to authentication options, GitHub can help you meet your team’s requirements.
+
+ Prevent problems before they happen. Protected branches, signed commits, and required status checks protect your work and help you maintain a high standard for your code.
+
+
+
Access controlled
+
+ Encourage teams to work together while limiting access to those who need it with granular permissions and authentication through SAML/SSO and LDAP.
+
+
+
Hosted where you need it
+
+ Securely and reliably host your work on GitHub.com. Or, deploy GitHub Enterprise on your own servers or in a private cloud using Amazon Web Services, Azure or Google Cloud Platform.
+
+
+
+
+
+
+
+
+
+
+
+
+ Integrations
+
+
+ Build on GitHub
+
+
+ Customize your process with GitHub apps and an intuitive API. Integrate the tools you already use or discover new favorites to create a happier, more efficient way of working.
+
+ Get started for free — join the millions of developers already using GitHub to share their code, work together, and build amazing things.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ You can't perform that action at this time.
+
+
+
+
+
+
+
+
+
+
+
+
+
+ You signed in with another tab or window. Reload to refresh your session.
+ You signed out in another tab or window. Reload to refresh your session.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/monkey/0009/main.py b/monkey/0009/main.py
new file mode 100644
index 00000000..8028f3fc
--- /dev/null
+++ b/monkey/0009/main.py
@@ -0,0 +1,29 @@
+# -*- coding:utf-8 -*-
+
+'''
+
+第 0009 题:一个HTML文件,找出里面的链接。
+
+@Author monkey
+@Date 2017-8-31
+'''
+import json
+
+from bs4 import BeautifulSoup
+
+
+def findTagA():
+ path = "The world's leading software development platform · GitHub.html"
+
+ with open(path, encoding='UTF-8') as file:
+ soup = BeautifulSoup(file)
+
+ # print(soup.prettify())
+ links = []
+ for i in soup.find_all('a'):
+ links.append(i['href'])
+
+ print(links)
+
+if __name__ == '__main__':
+ findTagA()
\ No newline at end of file
diff --git a/monkey/0013/README.md b/monkey/0013/README.md
new file mode 100644
index 00000000..482eb81a
--- /dev/null
+++ b/monkey/0013/README.md
@@ -0,0 +1,7 @@
+###题目要求:
+* 用Pyhton写一个爬图片的程序,爬这个链接里的日本妹子图片
+* 地址:http://tieba.baidu.com/p/2166231880
+
+###Topic request
+* Use Python to write a crawl program and crawl photos of Japanese girls from url
+* URL:http://tieba.baidu.com/p/2166231880
\ No newline at end of file
diff --git a/monkey/0013/main.py b/monkey/0013/main.py
new file mode 100644
index 00000000..8437bc33
--- /dev/null
+++ b/monkey/0013/main.py
@@ -0,0 +1,34 @@
+# -*- coding:utf-8 -*-
+from lxml import etree
+import requests
+import urllib
+
+__author__ = 'monkey'
+
+
+# 获取url地址,对页面进行爬去
+def spider(url):
+ html = requests.get(url)
+ selector = etree.HTML(html.text)
+
+ picitems = []
+ picitems = selector.xpath('//div[@class="d_post_content j_d_post_content clearfix"]/img[@class="BDE_Image"]')
+ print(len(picitems))
+
+ i = 0
+ for pic in picitems:
+ url = pic.xpath('@src')[0]
+ #print(url)
+ dir = './%d.jpg'%i
+ download_Image(url, dir)
+ i += 1
+
+
+# 下载图片
+def download_Image(url, save_path):
+ urllib.urlretrieve(url, save_path)
+
+
+if __name__ == '__main__':
+ url = "http://tieba.baidu.com/p/2166231880"
+ spider(url)
diff --git a/monkey/0014/main.py b/monkey/0014/main.py
new file mode 100644
index 00000000..2f3bc10e
--- /dev/null
+++ b/monkey/0014/main.py
@@ -0,0 +1,56 @@
+# -*- coding:utf-8 -*-
+
+'''
+
+第 0014 题: 纯文本文件 student.txt为学生信息, 里面的内容(包括花括号)如下所示:
+{
+ "1":["张三",150,120,100],
+ "2":["李四",90,99,95],
+ "3":["王五",60,66,68]
+}
+请将上述内容写到 student.xls 文件中。
+
+@Author monkey
+@Date 2017-8-31
+'''
+import json
+import xlwt
+
+def getStudent():
+
+ with open('student.txt', 'r', encoding = 'UTF-8') as file:
+ text = ''
+ for line in file:
+ text = text + line
+
+ stu_json = json.loads(text, encoding = 'UTF-8')
+
+ print(stu_json)
+
+ writeInXLS(stu_json)
+
+
+def writeInXLS(dict):
+ fileName = 'student.xls'
+ # 创建 xls 文件
+ file = xlwt.Workbook(encoding = 'utf-8')
+ # 创建 表
+ sheet = file.add_sheet('student', cell_overwrite_ok=True)
+
+ row = 0
+ col = 0
+
+ for k, v in sorted(dict.items(), key=lambda d:d[0]):
+ sheet.write(row, col, k)
+ for i in v:
+ col += 1
+ sheet.write(row, col, i)
+
+ row += 1
+ col = 0
+
+ file.save(fileName)
+ print('写入成功')
+
+if __name__ == '__main__':
+ getStudent()
\ No newline at end of file
diff --git a/monkey/0014/student.txt b/monkey/0014/student.txt
new file mode 100644
index 00000000..f06a601f
--- /dev/null
+++ b/monkey/0014/student.txt
@@ -0,0 +1,5 @@
+{
+ "1":["张三",150,120,100],
+ "2":["李四",90,99,95],
+ "3":["王五",60,66,68]
+}
\ No newline at end of file
diff --git a/monkey/0014/student.xls b/monkey/0014/student.xls
new file mode 100644
index 00000000..19e2d043
Binary files /dev/null and b/monkey/0014/student.xls differ
diff --git a/monkey/0015/city.txt b/monkey/0015/city.txt
new file mode 100644
index 00000000..312f5c19
--- /dev/null
+++ b/monkey/0015/city.txt
@@ -0,0 +1,5 @@
+{
+ "1" : "上海",
+ "2" : "北京",
+ "3" : "成都"
+}
\ No newline at end of file
diff --git a/monkey/0015/city.xls b/monkey/0015/city.xls
new file mode 100644
index 00000000..bf246c7d
Binary files /dev/null and b/monkey/0015/city.xls differ
diff --git a/monkey/0015/main.py b/monkey/0015/main.py
new file mode 100644
index 00000000..e4ef735d
--- /dev/null
+++ b/monkey/0015/main.py
@@ -0,0 +1,54 @@
+# -*- coding:utf-8 -*-
+
+'''
+第 0015 题: 纯文本文件 city.txt为城市信息, 里面的内容(包括花括号)如下所示:
+
+{
+ "1" : "上海",
+ "2" : "北京",
+ "3" : "成都"
+}
+请将上述内容写到 city.xls 文件中,如下图所示:
+
+@Author monkey
+@Date 2017-8-31
+'''
+import json
+import xlwt
+
+def getCity():
+
+ with open('city.txt', 'r', encoding='UTF-8') as file:
+ text = ''
+ for line in file:
+ text = text + line
+
+ city_json = json.loads(text, encoding = 'UTF-8')
+ print(city_json)
+
+ writeInXLS(city_json)
+
+
+def writeInXLS(dict):
+ fileName = 'city.xls'
+
+ # 创建 文件
+ file = xlwt.Workbook()
+ # 创建 表
+ sheet = file.add_sheet('city', cell_overwrite_ok=True)
+
+ row = 0
+ col = 0
+
+ for k, v in sorted(dict.items(), key=lambda d:d[0]):
+ sheet.write(row, col, k)
+ col += 1
+ sheet.write(row, col, v)
+
+ row += 1
+ col = 0
+
+ file.save(fileName)
+
+if __name__ == '__main__':
+ getCity()
diff --git a/monkey/0016/main.py b/monkey/0016/main.py
new file mode 100644
index 00000000..170ef6bb
--- /dev/null
+++ b/monkey/0016/main.py
@@ -0,0 +1,55 @@
+# -*- coding:utf-8 -*-
+
+'''
+纯文本文件 numbers.txt, 里面的内容(包括方括号)如下所示:
+
+[
+ [1, 82, 65535],
+ [20, 90, 13],
+ [26, 809, 1024]
+]
+请将上述内容写到 numbers.xls 文件中,如下图所示:
+
+@Author monkey
+@Date 2017-8-31
+'''
+import json
+import xlwt
+
+def getNumber():
+
+ with open('numbers.txt', 'r', encoding='UTF-8') as file:
+ text = ''
+ for line in file:
+ text = text + line
+
+ number_json = json.loads(text, encoding = 'UTF-8')
+ print(number_json)
+
+ writeInXLS(number_json)
+
+
+def writeInXLS(list):
+ fileName = 'numbers.xls'
+
+ # 创建 文件
+ file = xlwt.Workbook()
+ # 创建 表
+ sheet = file.add_sheet('numbers', cell_overwrite_ok=True)
+
+ row = 0
+ col = 0
+
+
+ for l in list:
+ for i in l:
+ sheet.write(row, col, i)
+ col += 1
+
+ row += 1
+ col = 0
+
+ file.save(fileName)
+
+if __name__ == '__main__':
+ getNumber()
diff --git a/monkey/0016/numbers.txt b/monkey/0016/numbers.txt
new file mode 100644
index 00000000..f5062e0a
--- /dev/null
+++ b/monkey/0016/numbers.txt
@@ -0,0 +1,5 @@
+[
+ [1, 82, 65535],
+ [20, 90, 13],
+ [26, 809, 1024]
+]
\ No newline at end of file
diff --git a/monkey/0016/numbers.xls b/monkey/0016/numbers.xls
new file mode 100644
index 00000000..3c9c2f3d
Binary files /dev/null and b/monkey/0016/numbers.xls differ
diff --git a/patchlion/0000/DrawHeadImage.py b/patchlion/0000/DrawHeadImage.py
new file mode 100644
index 00000000..8bbc5148
--- /dev/null
+++ b/patchlion/0000/DrawHeadImage.py
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+__author__ = 'PatchLion'
+
+from PIL import Image, ImageDraw,ImageFont
+
+def drawNumberOnIcon(imgpath, number):
+ img = Image.open(imgpath)
+ if (None == img):
+ print('打开图片失败')
+ return
+
+ img = img.resize((160, 160))
+
+ print(imgpath, "->", img.format, img.size, img.mode)
+ draw = ImageDraw.Draw(img)
+ img_size = img.size
+
+ font = ImageFont.truetype("Varela-Regular.otf", size=int(img_size[1]/4))
+ text_size = font.getsize(str(number))
+
+ draw.text((img_size[0]-text_size[0], 0), str(number), font=font, fill=(255, 0, 0))
+
+ img.save('icon_withnumber.jpg')
+
+ print('生成图片成功')
+
+
+drawNumberOnIcon("icon.jpg", 21)
\ No newline at end of file
diff --git a/patchlion/0000/Varela-Regular.otf b/patchlion/0000/Varela-Regular.otf
new file mode 100644
index 00000000..206f95a8
Binary files /dev/null and b/patchlion/0000/Varela-Regular.otf differ
diff --git a/patchlion/0000/icon.JPG b/patchlion/0000/icon.JPG
new file mode 100644
index 00000000..8d50fbef
Binary files /dev/null and b/patchlion/0000/icon.JPG differ
diff --git a/patchlion/0000/icon_withnumber.jpg b/patchlion/0000/icon_withnumber.jpg
new file mode 100644
index 00000000..af81baea
Binary files /dev/null and b/patchlion/0000/icon_withnumber.jpg differ
diff --git a/patchlion/0001/CreateSN.py b/patchlion/0001/CreateSN.py
new file mode 100644
index 00000000..3b2980a4
--- /dev/null
+++ b/patchlion/0001/CreateSN.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+__author__ = 'PatchLion'
+import uuid
+
+def createSN(count):
+ if count <= 0:
+ return
+
+
+ sns=[]
+
+ for i in range(count):
+ sns.append(uuid.uuid4().hex.upper())
+
+ return sns
+
+def createSNAndSaveToFile(count, filepath):
+ sns = createSN(count)
+
+ with open(filepath, 'wt') as f:
+ for sn in sns:
+ f.write(sn+"\n");
+
+print(createSN(200))
+createSNAndSaveToFile(200, 'sns.txt')
\ No newline at end of file
diff --git a/patchlion/0001/sns.txt b/patchlion/0001/sns.txt
new file mode 100644
index 00000000..8b3caa4e
--- /dev/null
+++ b/patchlion/0001/sns.txt
@@ -0,0 +1,200 @@
+D6E7BE4F8DBB400DBCADFC71D0397C95
+E3C83441DCBD4916A4E921CF7E69BEEF
+6DEB7C95E46B443FB464203C3239CAC9
+D9FCB5F316A743AB914E46074D813F08
+53896AC8D6EC4781AFE08D7A41FDD62A
+A454638CA4F841698CD8443328053B8A
+F1BD39FDDF6E488A96ED03ACE0880989
+7A18B38339AB42F0A29F96A13A65277C
+92E8E5957A93425283CD8F9A5C7AC6A9
+1682747B4AC14B6BB854220C7795C351
+40584A6C19AB462FA0EDFEBCBA200317
+3B38874AD4E14D0384898C3F71570EA2
+6B3570EF96B343D2BA66D667202B7999
+756269BE448C46E989CEB279F4E6A0AC
+8857CD736ECD45579A0E5BF365DFE303
+2DF003F62F8B4FD78C3582B2336FECD9
+0120A4D066C044C3BF4B3F283AC93F1C
+685CBE0E5EC34384B435DFE05549E264
+EAECEAF83D214376937410867FFF813F
+08EC93DB931E455099F207D64B2EF7BA
+C27E8749C60443FAA1C9D332D8056E7D
+BF2AF04E1BEB47E2808BB9F89CE48A57
+35806F99395D48CE95F3B20DB2C72877
+98C4CD32A09C47FCA792984144E34789
+69913A451CE943AC8F46E373C260E76F
+88783C30A1A5418C9852CE1C11D66FC5
+251DFA24C113427DB1A4F84AD4A0A16B
+A631E2EC4F804195A65C47EA3EC7BFE2
+DAF81DCA20374B50A4C2E5901FAFFE4C
+E2705D418FD6428AA6F89232A03D1DF1
+2C09E4830228428B8683EF48662FD533
+B59451DA98094A439467E55A36BD1015
+54DA1A69C6994A96A2E3DD3F52AB47EB
+298EACA4ED254F22AA577BF3F070F21D
+6D3B63EE76E4440289ED91E9EAA2374B
+2FDCEEC57F2F4D0E83C312DAE6404E0E
+10C1BE2B6EE74AEEA798FD4F76D16F27
+4E73A1BAA99741B2B484DCDAD5541D97
+4CB1C9F16AA74FC996786497A034CF7A
+1E5F42316AAF44B48F06F72C5DCADC96
+D97FFA9C38A74848AD4FFDC0BCDFE397
+D527818259154E03AFD63714A59D6CCF
+5DDA33ADDA7A4C7380A7DFE5DAF429A5
+93B40E7017124F0083C13F2244DD58CB
+FD657708028A462D9BFC2143B0E7F847
+B30EEFE0D52843DC9A7F71C5A2108A60
+BCA196A6BBE44AADAC7B1C421A7ED832
+2C7191D0AB0F4E1AA45CBC8756E6987F
+BF15546D4BD84E02964D76165E9022D4
+C9DDD80402594334A5C4828C04832D60
+FA6532A3000C45478862A0156AD3E373
+F16CB5B1C76743379DE2104683CB840E
+2B5C6D0A188D462A8F3D7930ACB112D3
+F3EA1DF6A64146D592FA562C18BF4DD2
+4C52BFA77E654E178E4F096DB33C3D5B
+5DC2FD42388D48E7A95723E59BE1C259
+D291D238B3934F4FBF50E34452CFD557
+42C0AD39833949AD9BE90DA9444AD1D1
+4E8F59CF678445C494F34B5DA27D05B6
+7DBB506CB74D4C5AA7BC71A8C9F9846E
+4DFDB7E3E0DD4C4A9E08CFE4053692F1
+7B322AE2926B4FD69080BB9012447437
+302D9BD6D5CB4B88B1A3213057C5CC45
+7D09EEAC14B648C39C92088DDCCC8B7E
+6B3ED4C47E334791AE1CED843DAE4899
+CEA81BDA91A8439FB3018BEFB646F019
+315DBE136DB34FCA903D631286B1A662
+4B017A55EA7D410AAA790D2333C61594
+966549CCFA5C4B03BE79CFD916DC6269
+583AB01B84EA47CDA5A5C53AA27F06AA
+8E6DFAF297584D0AAB6ACFA339830A83
+A65F7467EFA34D61B2D20C1195841148
+06F4F523DCD94696906F2E2A56B46AC1
+5A6A59EE44E34E42AD58933B65227E05
+FA83E66777134C51BA4DA9E94956C6CD
+B64A713D76B941539628EA92B50A02D8
+9DCEA293DBCB45B2B560F6ECCEFCBF7B
+E55AF3850F6A4F07BB28E47065D8A238
+3B58A064F9174242829B8E0ADF8BA09B
+97A8300DD587458A92823F65DEFFFBB8
+F3A78DC166E94581A281533065F17311
+2D581CC2F7A2474B966C456559FAE3DA
+4536F8162A2041F68CB07E86BD2F46C2
+5153184E53234ACC8874EE00EF6FDA0E
+D57EB677DA234B629A24C056CB72BE00
+91901A4D1E1241448A6FD6C2413E818F
+93BB457333444545B4CB7A18F1934FDF
+9674B8DA0F2A405BB7E236DD40EDC7F1
+8207517B57AB484CB47DE54CBA20C893
+47A22567975746D2B42B822E5CBA4392
+C6BA941DCA8B409990A24BF64C9E06AA
+4421081C06EE48218C5B1D173D29804A
+367C39E7266A454E95D7888C9CE78F1C
+05E590CB231A40F3B8CA9F9FEAD869D9
+FCE6EC0EF03A4103BE4247525DCF7B79
+EBCC771A7DE74ADD989A81D586170E6B
+9C6060D6ECCF4A39BD08ABD50620D8EB
+EBD26DD692964D14BFBA5A7E3B934338
+D7575BEF63CB4A779FF25E9CBC864EC4
+7B41987358D24CDCA157FFF855B3420D
+D2A7DDC6BACC4A98B8239438CDACB3EE
+C4316AB1F8584178B0E06A263F9DBCA8
+A0FE533D1D0B43398109ADB210CD0404
+E68EAF900E9A410B8FDB13F32ECAFEC2
+55617EA7008A44D1AD5E8016410E1107
+FB952D010F9F4F32AC2364BA13475B17
+24980F4C2248479BA54A3FCD35D8C1A9
+58AD60569A774F16B1D551E097E9454F
+F9766715F95C416891A658475839AE7D
+F670ECA0929149FFA1D5AA272EACF1AD
+05F0A37684534FA282815093E7413D6A
+EFA810265E5F4D80BA80BC3E0F36ECFD
+96C9599153014A088DFCFE93E183C3F6
+C1762FCD8A9F4682ACA98D4CACCE24D0
+E4C8F0053414449294F74D190DD291E4
+199689A96CD041EB85CAE8C57BC6310E
+048927803E8D40E3AFF100314A163DC8
+B9818ADDA4E54AD7B0BDE413849F42D3
+E83CC52FFD6C481D9526C0E890D12723
+47E26674DCA54DA2B0A6D1BAB5854CF3
+102D42B66DA74A25923E5FE663FB7D82
+CD8438F4F88E419FB70BD6AD461C8BAD
+873FEA3FCB044970B15937CCFCC1AA13
+4025E874E046480BA91291D25D838E30
+B70D2D7AD78740F8979B9042E1E67B0A
+2DE11879D52848128C2E3378E45E8C54
+99D680CCBB3A45AF8B0ABFBF32E57FF1
+4B3A7DE5BF6A488B8339910416E8C611
+4E5AD5924441485E932DD7120284E93E
+D3C60168186244B2AA3FA579513A12D6
+75A9BD60F766410391861B8F6B958204
+7D3AB7509B1F4BF3B582446B759D16F9
+5A931FC10B1747FCA968B36A94DA6372
+1127110D4E66430C8A05128A87CF9BF5
+2E3391B7DCAB47FCBA4121925EE72616
+D585934B00364D22A44DC6F8A170BABA
+F3375085D86347B8A9346EEB05D85EFE
+6C98A9EB8CE5402A8008BC06E57FB72B
+9C8528B3090E448DA64DE005811834CB
+6394A70E285F4BADBC4D0C866DA3F8C7
+9DED2AC8E5914DFF8299309527764ADE
+8CE5DA9D7B57476FBC00AC7AD1B9CE03
+0D6C8D235E694E429FA84D3380FF4F26
+B7232772ECC54307B5C3834B2C3952E2
+A94A3B61F994447F9B3171D8078F0475
+B726C16CB4D04E7590221B40197BC76C
+A3C917BC085443558E87C352A9EDCD4E
+17622D7067D941B6BB505AF0E4F27B6D
+23218F4A89A549CAA2B30A992A37C639
+126DCC5794D44B4C8FE63CA36ECCDB5E
+B5EA3D5D1A88464C8E5EBB1BB287E972
+7A8BEB2465C8408DA00201C1F7B4AA10
+F3AF716F58654B02B97433A27846C7E7
+A87AE973D49D4154AC9D3BD4D7081436
+F44F33C608F6454F997D497B26FB3BBA
+969C4D7030C74661BCE12F793068D9D4
+D4DB2913A8D64F2BA98FEEB16028ECD3
+A4AE0465CCDC442FB3A793757CCB28A3
+8102CF06BAD24BBD8BEC48828AAC7D21
+CCD9B4EC7A67422D9447600ADDBE14EA
+4A138CC7A4924CE99E0B22A838AD5B17
+04C5741D3D594A1EBDE6A9C44A3AEB2E
+F3E98C2A7E0E4CDCB77BBE53BFC9CB20
+9983125A3B544AAE8F3FAEEE67780D43
+C92790AA97A54BCE9BC99210482722D0
+4124C0BE33024CD68CE0CB81289DBABA
+D31F84B4EBA54F9EA1A63377DA620B02
+56ABB33312C14F6D95EF9B7E939355FD
+A00C5FCC2A46473F8FBB9571C68925D0
+7DF5ABC4D6C841DDB65646C2101CDF75
+7DFB1BE67C1141CCA708EF1B0A2039D2
+77B726FD00DA4F42B8DE56B77B363FF8
+BC821284EE9D4EF99599A254301B7A9B
+0FAA403A28DF4396B3E020FEB7EA79DF
+F568103AA32E4985B544DF03CF6EB513
+8F8493CA9DC545CEB05A2BC09A0F2E5A
+682F0A441022424D89EE3F17DC6F4BD9
+FA74F790D66E4DAA9AA842EF0030FD24
+B984010789BB4B74AC0F4C8635C3912B
+AA6D2CBA27C643D48A8DB81A4EB16299
+9438EF86D80B4438948B8D593D90C91A
+59C16C42EF514F78835521931A03D9B5
+8189E4E9B8AD4092BFBF24DC76D92C5C
+AE5386C5809347D4A899218C86B0D10A
+A450A51757EA4CD0B47528D2FD4E9A5F
+DADFE9DE21A545F881F96D31ED817BB5
+CAAABF11539A49A5A7E5E055E18C5262
+B793CACDF5AE464F86ABC432966F3853
+D9B0417D1560454AADF1D87ECD98967A
+2262EE1EA75C4FDF8674EE2271D23FD8
+91380450B6474EA69C4D3A1DE3280A23
+2B67B8C203C648FCA5F6C0A0B085837F
+49AAAB2A48C645B5B0E2A3EA94143EB4
+AEC612FF401E4F448C9B5B5F32CA3F95
+BB651687308E420E84C2BF2475F1BBFC
+6BAFD6CE048644E6AF4C83B445A44167
+94775518A9CE40F3892427E4C0F9AA28
+27BE68E1B727408499DB50CDED3042F3
+212F1919D1FD44EDA80652FC1BB9B5D7
+4898E391F2704A81BA13D664A9ED433D
diff --git a/patchlion/0002/SaveSNsToMySQL.py b/patchlion/0002/SaveSNsToMySQL.py
new file mode 100644
index 00000000..ae7ee817
--- /dev/null
+++ b/patchlion/0002/SaveSNsToMySQL.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+__author__ = 'PatchLion'
+
+import pymysql
+
+sns = []
+
+with open('../0001/sns.txt', 'rt') as f:
+ for line in f.readlines():
+ sn = line.strip()
+ sns.append(sn)
+
+print(sns)
+
+def insertToDB(sns):
+ if(len(sns) == 0):
+ return
+
+ conn = pymysql.connect(host='127.0.0.1', port=3306,user='root',password='root', db='python')
+ cur = conn.cursor()
+ try:
+ cur.execute('DELETE FROM sns')
+ conn.commit()
+
+ for sn in sns:
+ cur.execute('INSERT INTO sns VALUE ("%s")' % sn)
+ conn.commit()
+ conn.close()
+
+ print('Done!')
+ except:
+ conn.rollback()
+
+
+insertToDB(sns)
\ No newline at end of file
diff --git a/patchlion/0004/CountChar.py b/patchlion/0004/CountChar.py
new file mode 100644
index 00000000..00b4c7de
--- /dev/null
+++ b/patchlion/0004/CountChar.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+__author__ = 'PatchLion'
+
+result = {}
+
+def doCount(c):
+ if c in result.keys():
+ result[c] = result[c]+1
+ else:
+ result[c]=1
+
+def countChar(file_path):
+ with open(file_path, 'rt') as f:
+ txt = f.read()
+ f.close()
+ list(map(doCount, txt))
+
+countChar('PrivacyPolicy.txt')
+
+print(result)
+print(len(result))
diff --git a/patchlion/0004/PrivacyPolicy.txt b/patchlion/0004/PrivacyPolicy.txt
new file mode 100644
index 00000000..2400c7cd
--- /dev/null
+++ b/patchlion/0004/PrivacyPolicy.txt
@@ -0,0 +1,37 @@
+Privacy Policy
+Last Updated: July 13, 2015
+=========================
+Your privacy is important to xxxxx. Our Privacy Policy covers how we collect, use, disclose, transfer, and store your information. We hope our policy is straightforward and easy-to-understand. Please take a minute to review the details of our privacy practices below.
+
+Collection and Use of Non-Personal Information
+We may collect non-personal information, such as data that does not allow direct association with any specific individual. Non-personal data is collected, used, transferred, and disclosed for a number of purposes. These purposes include the use of cookies and other technologies that give us a better understanding of our users' needs. A "cookie" is a small data file that is stored on your device. Most Internet browsers automatically accept cookies. We use information collected from cookies to improve users' experience and the overall quality of our services.
+
+Collection and Use of Personal Information / Content
+Personal information may be collected in a number of ways when you use any of the products or services offered by xxxxx. We may prompt you to voluntarily provide information, including personal information. For example, we may ask to collect your name, email address, user name, telephone number and credit card number whenever you register for an account, purchase our products, or contact us via email.
+
+From time-to-time we may also collect personal information you provide in connection with your participation in surveys, sweepstakes, contests, promotional offers, and other activities on the site.
+
+When you use our email support services, we collect your correspondence in order to build up a public knowledge base, which will be available to all users of the site. Your correspondence will most likely not be used verbatim, but paraphrased in an FAQ format.
+
+We use the information collected through xxxxx products: (I) to communicate with you; (II) to process your requests and transactions; (III) to improve the site; (IV) to customize the services and/or products we provide to you; (V) to assist with our product and service development; (VI) to perform marketing analysis; and (VII) for other purposes related to our business.
+
+The images you upload to xxxxx for editing will not be stored unless your request a link to revisit your works or you actually request a xxxxx service that requires storage of this image (e.g. to temporarily save the unfinished works under your xxxxx account).
+
+If you are using xxxxx Market Service to share / sell your photo works, refer to clause "3 xxxxx's Use" of the "xxxxx Market Terms" in the "Terms of Services" for detailed information on how we handle these images.
+
+Transparency and Choice
+You may configure your browser to block cookies, including cookies associated with our services. However, many of our services may not function correctly with cookies disabled. You can also control which social websites you upload images to.
+
+Third party accounts
+xxxxx does not store your Facebook, Twitter, or Flickr passwords. Your account information is not disclosed to xxxxx and you are free to cancel any of your social networking website connections with xxxxx at any time.
+
+Enforcement
+We regularly review our own compliance with our Privacy Policy. If you submit a formal written complaint, we will contact you and try our best to resolve the issue.
+
+Changes
+Our Privacy Policy may change occasionally. We will not reduce your rights under this Privacy Policy without providing explicit, advanced notice. We will post any privacy policy changes on this page and, in the event of significant changes, we will provide a more prominent notice (such as an email notification). We will also archive prior versions of this Privacy Policy for your review.
+
+
+If you have any questions regarding this Privacy Policy, please feel free to contact us(Support@xxxxx.com).
+
+
diff --git a/patchlion/0010/CreateIdentifyingCode.py b/patchlion/0010/CreateIdentifyingCode.py
new file mode 100644
index 00000000..8a9fc92b
--- /dev/null
+++ b/patchlion/0010/CreateIdentifyingCode.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+__author__ = 'PatchLion'
+
+from PIL import Image, ImageDraw, ImageFont, ImageFilter
+import random
+
+def randChar():
+ #65-90 A-Z
+ return chr(random.randint(65, 90))
+
+def randColor():
+ return (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
+
+def createIdentifyingCode(size, charcount=4):
+ width=size*charcount
+ height=size
+
+ img = Image.new('RGB', (width, height), (255, 255, 255))
+ draw = ImageDraw.Draw(img)
+ for x in range(width):
+ for y in range(height):
+ draw.point((x, y), fill=randColor())
+
+ font = ImageFont.truetype("../0000/Varela-Regular.otf", size=size)
+ #draw.text((0, 0), randChar(), fill=randColor())
+ for i in range(charcount):
+ draw.text((i*size + 10, -10), randChar(), fill=randColor(), font=font)
+
+ img = img.filter(ImageFilter.BLUR)
+ img.save('ic.jpg', 'jpeg')
+
+createIdentifyingCode(60)
+
diff --git a/patchlion/0010/ic.jpg b/patchlion/0010/ic.jpg
new file mode 100644
index 00000000..ac1461a8
Binary files /dev/null and b/patchlion/0010/ic.jpg differ
diff --git a/preytaren/README.md b/preytaren/README.md
new file mode 100644
index 00000000..e558abb8
--- /dev/null
+++ b/preytaren/README.md
@@ -0,0 +1,3 @@
+# Show-Me-the-Code
+preytaren 的解答链接 [戳这里](https://github.com/preytaren/showMeTheCode-Solutions),
+大概完成了20个题目左右
diff --git a/problem 0001/0001.py b/problem 0001/0001.py
new file mode 100644
index 00000000..42848e97
--- /dev/null
+++ b/problem 0001/0001.py
@@ -0,0 +1,22 @@
+import string
+import random
+def coupon_creator(digit):
+ coupon=''
+ for word in range(digit):
+ coupon+=random.choice(string.ascii_uppercase + string.digits)
+ return coupon
+
+def two_hundred_coupons():
+ data=''
+ count=1
+ for count in range(200):
+ digit=12
+ count+=1
+ data+='coupon no.'+str(count)+' '+coupon_creator(digit)+'\n'
+
+ return data
+
+
+coupondata=open('coupondata.txt','w')
+coupondata.write(two_hundred_coupons())
+coupondata.close()
\ No newline at end of file
diff --git a/problem 0001/coupondata.txt b/problem 0001/coupondata.txt
new file mode 100644
index 00000000..68b17187
--- /dev/null
+++ b/problem 0001/coupondata.txt
@@ -0,0 +1,200 @@
+coupon no.1 FWJW0YIBITUL
+coupon no.2 NQU7R8XJNBXG
+coupon no.3 ZG9GKKMSB6HV
+coupon no.4 O4XX21EKJX77
+coupon no.5 GUTI0CSN2C6X
+coupon no.6 C4MS2L6ZUC3L
+coupon no.7 6C9XNU5P9YNP
+coupon no.8 TDWZHJMH79T7
+coupon no.9 NK42DPL2KO7S
+coupon no.10 N9N53QOR49LF
+coupon no.11 QFKY2FA9YHO6
+coupon no.12 MPISYC004GMD
+coupon no.13 0JARTJT6INRB
+coupon no.14 5YE7OWV5TPXZ
+coupon no.15 T6Z42DZVZCV4
+coupon no.16 DOTG64M56IOZ
+coupon no.17 63LOHIBWKQW0
+coupon no.18 QMW1WS74YPSF
+coupon no.19 EDYA4BTEUEG8
+coupon no.20 3PP94R8DTXTH
+coupon no.21 SWTYQIFG59ZJ
+coupon no.22 5W66U5OE9EUL
+coupon no.23 04K6XU9CYP1S
+coupon no.24 380F1KRRJ952
+coupon no.25 Q7C3IBPCVGPG
+coupon no.26 516U37YWS0TD
+coupon no.27 PDZVA7NHPYIJ
+coupon no.28 1H5ONS7OKN7Q
+coupon no.29 CP447S7EIWCC
+coupon no.30 CYVFITE5CHUJ
+coupon no.31 XNYD11NWD3FN
+coupon no.32 593GXVHNSR1I
+coupon no.33 O4N12KSNXTQU
+coupon no.34 3FSNMKHUA9GG
+coupon no.35 5I6QC0FFEY55
+coupon no.36 T2H84ALIBJVS
+coupon no.37 U0WAUXJDB0OG
+coupon no.38 GUO20ACL1M18
+coupon no.39 2NDT0788JBT4
+coupon no.40 E9SFSETUOJZV
+coupon no.41 1Y553JWA9DIT
+coupon no.42 F1MQIGIVH1CV
+coupon no.43 B9E303O9UW6O
+coupon no.44 LTJI2OREX7FM
+coupon no.45 L4YDRNS9UHFX
+coupon no.46 T0L8MPN9U7BG
+coupon no.47 0GK0Y1WR4RTE
+coupon no.48 T08Y1R1F0FJA
+coupon no.49 KU0ROH2G2DAZ
+coupon no.50 AIXMX3R4P368
+coupon no.51 02A2IM6O36JY
+coupon no.52 6T4855XEPR5J
+coupon no.53 28P308KD20JK
+coupon no.54 ZJVP7I1JYB3X
+coupon no.55 EPY8ABOLUB1F
+coupon no.56 UDBEUPSFVAY7
+coupon no.57 NOCBFKB5L68F
+coupon no.58 TLK5PPPNTAYB
+coupon no.59 O3OBACP3WDJV
+coupon no.60 WKOCO2RMO3RB
+coupon no.61 J69JSK7MPDYZ
+coupon no.62 RGHO0FOCFT97
+coupon no.63 FO4XB61Y8WBV
+coupon no.64 WGL60PE7P1OJ
+coupon no.65 JDCAMB4K9EY9
+coupon no.66 AR5OPUT1WKSP
+coupon no.67 RHDAXFBN9K1E
+coupon no.68 05505M3PS7MJ
+coupon no.69 JSI9TRQGLXMG
+coupon no.70 OWCQSH53LLKM
+coupon no.71 X4HCRNGD8B5J
+coupon no.72 HP44PXN8W8B7
+coupon no.73 1H4IINT9ZDVG
+coupon no.74 S63YHUKU5UPU
+coupon no.75 OINDDAQYU3LQ
+coupon no.76 B8RG2RL7JDEM
+coupon no.77 LRH1KU8C42O6
+coupon no.78 ZKO3WO1K7ZN7
+coupon no.79 RA0LHH0ORS40
+coupon no.80 OVFUSWG36AJQ
+coupon no.81 B2I23IWM0QDK
+coupon no.82 2T66MPUSXLO8
+coupon no.83 UH8CDZE1A1FH
+coupon no.84 0PF0QTBUNHXI
+coupon no.85 RWHH6PJIM7AJ
+coupon no.86 5G51MCB9GSLZ
+coupon no.87 PWF1AXVE5BOK
+coupon no.88 URJO6LTL1OL0
+coupon no.89 88PVJOLP8107
+coupon no.90 4QZSWWA6CXWM
+coupon no.91 EM87EHTI6X8D
+coupon no.92 KXF4P56RR6P1
+coupon no.93 BTNBZ2CHQR4V
+coupon no.94 0W9S44Y8U16U
+coupon no.95 0R4AZ9EB7D6X
+coupon no.96 AZTKVO9LJJN9
+coupon no.97 6YTJ9N2TAQJB
+coupon no.98 Y1IA11Y34I0D
+coupon no.99 EWM4U6S4DBJN
+coupon no.100 QD4AQ3A7STDP
+coupon no.101 CHSNVU5ZW8GB
+coupon no.102 1NHDYWU00Q3O
+coupon no.103 QGTXZWO96PA9
+coupon no.104 49AP05QRNTRF
+coupon no.105 9SXMO0QPWOCP
+coupon no.106 I6A6GEJLNKHW
+coupon no.107 F9FK75OXX340
+coupon no.108 WGFPSQWJSTQR
+coupon no.109 YPF79O3X5NRT
+coupon no.110 QN23EXDFKDW8
+coupon no.111 ZT4T54WRM7QK
+coupon no.112 QA78PI358R74
+coupon no.113 S8UGJUXFZP6U
+coupon no.114 WU6COWJW7DTM
+coupon no.115 QPL1WSMCKLPD
+coupon no.116 A98P5VQK74BP
+coupon no.117 M6X08E3OURYN
+coupon no.118 M8GF4JOFQZ0C
+coupon no.119 TDTJV2I079TE
+coupon no.120 LLMRA43NL2J9
+coupon no.121 2BYQY8EFL35L
+coupon no.122 7B5ANII8ZHFW
+coupon no.123 D20WEWW7OB21
+coupon no.124 Y8TWI7OF7H2L
+coupon no.125 57CT9SZ03ZYB
+coupon no.126 FHPAMN9EXI6P
+coupon no.127 CPVFJQR6SI4K
+coupon no.128 PXAUDBIGIQLJ
+coupon no.129 SYACJYLSR19L
+coupon no.130 ZX9586DVR42P
+coupon no.131 FD3GK84USH9U
+coupon no.132 L6MZWX28N5J3
+coupon no.133 R88G9MC9ZIW4
+coupon no.134 R25QCRFXWK7P
+coupon no.135 811SMYNGDOJP
+coupon no.136 CEYYUOVZU4WB
+coupon no.137 GFFS1KRXBJRF
+coupon no.138 V61XLSIBNJZ9
+coupon no.139 HHJRITKF8LA0
+coupon no.140 KMZNXQ4OXRYG
+coupon no.141 AX5B3DODGMVG
+coupon no.142 IDR4RZ0H9AN3
+coupon no.143 78HVUWSM2MFN
+coupon no.144 HKETH9WRDEC8
+coupon no.145 NC9ESBZ5VILI
+coupon no.146 4FLER6LSOLCH
+coupon no.147 L0ZCC7SZHJ16
+coupon no.148 FPJN2MVKFRMD
+coupon no.149 2FA6D4HBDGRC
+coupon no.150 YLW7YHKA27CB
+coupon no.151 R2AHCEVUZIWQ
+coupon no.152 QWXGCIZSSMO5
+coupon no.153 A5M4DLS8JTY7
+coupon no.154 M8QYBQ50WLOU
+coupon no.155 P2RNVDU6XH82
+coupon no.156 8N1BBAAEGBL8
+coupon no.157 2PJN5G0V4494
+coupon no.158 JS2QAIQ93R7S
+coupon no.159 LRC9WWSREPBY
+coupon no.160 ST3RYQ1NN5MG
+coupon no.161 FQ0OCG793S9O
+coupon no.162 JZ4K0DDF10F6
+coupon no.163 SDNL4Q58BDF1
+coupon no.164 PR7ZWO97BZ8R
+coupon no.165 GWD0TPGLQG10
+coupon no.166 H627P3YBYJM2
+coupon no.167 2NBGKYA2GEEH
+coupon no.168 R9NE8UVSZYQO
+coupon no.169 6M6S808GQDJE
+coupon no.170 1FJLZ72UJN9O
+coupon no.171 QSWIVNAHY0ZV
+coupon no.172 40U7D9KGNSNJ
+coupon no.173 830BB34Z5UGD
+coupon no.174 OED6Q8LMPB6V
+coupon no.175 18VXH43MXZ5I
+coupon no.176 TBXOPC35KTET
+coupon no.177 NEKY3FDCXDWH
+coupon no.178 722G2Y5IVHGF
+coupon no.179 D0Y47HD6BQ9D
+coupon no.180 OZI60AVBQ28I
+coupon no.181 VXTAVAZWJ1G8
+coupon no.182 76M19IPC3C0T
+coupon no.183 V791ZQMP9147
+coupon no.184 6BV4ED7Q8ZF6
+coupon no.185 ONUJDDRA78DI
+coupon no.186 HRZOHHDTO9IG
+coupon no.187 4K1ZX4X12G4F
+coupon no.188 T6ZHZCCU85SF
+coupon no.189 4WWQZF5ABACB
+coupon no.190 ROXK6P3MNCT3
+coupon no.191 OWM6RQBOGF5S
+coupon no.192 E2ESEJ9Y6HLJ
+coupon no.193 DXJECVUTKZD5
+coupon no.194 2LMO21NCSBLG
+coupon no.195 FCUQWL99QLMA
+coupon no.196 HLJX67U1QQPB
+coupon no.197 0CZ43NJZ9ZG3
+coupon no.198 01O9E5A0IFFP
+coupon no.199 PCPUK158V1BS
+coupon no.200 HJVY7ZB890D0
diff --git a/problem 0004/solution for problem 0004.py b/problem 0004/solution for problem 0004.py
new file mode 100644
index 00000000..cdb4d9cb
--- /dev/null
+++ b/problem 0004/solution for problem 0004.py
@@ -0,0 +1,9 @@
+def count():
+ name = raw_input("Enter file:")
+ if len(name) < 1 : name = "test.txt"
+ handle = open(name)
+ count_words=list()
+ for line in handle:
+ count_words+=line.split()
+ return len(count_words)
+print count()
\ No newline at end of file
diff --git a/pylyria/0000/0000.py b/pylyria/0000/0000.py
new file mode 100644
index 00000000..999b5656
--- /dev/null
+++ b/pylyria/0000/0000.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+#第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。
+from PIL import Image, ImageFont, ImageDraw, ImageColor
+
+def image_add(file_name, text):
+ im = Image.open(file_name)
+ w, h = im.size
+ fnt = ImageFont.truetype('Arial.ttf', size=w//5)
+ draw = ImageDraw.Draw(im)
+ draw.text((w-w//5-10,10), font=fnt, fill=128, text=text)
+ im.show()
+
+if __name__ == '__main__':
+ image_add('icon.jpg', 'V')
diff --git a/pylyria/0001/0001_0.py b/pylyria/0001/0001_0.py
new file mode 100644
index 00000000..d8b94190
--- /dev/null
+++ b/pylyria/0001/0001_0.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+#第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
+import random
+import string
+
+def activation_code(id,length=16):
+ prefix = hex(int(id))[2:]+'V'
+ length = length - len(prefix)
+ chars=string.ascii_uppercase+string.digits
+ return prefix + ''.join([random.choice(chars) for i in range(length)])
+
+def get_id(code):
+ return str(int(code.upper(), 16))
+
+if __name__ == '__main__':
+ for i in range(10, 500, 23):
+ code = activation_code(i)
+ id_hex = code.split('L')[0]
+ id = get_id(id_hex)
+ print code,id
diff --git a/pylyria/0001/0001_1.py b/pylyria/0001/0001_1.py
new file mode 100644
index 00000000..7301c2f3
--- /dev/null
+++ b/pylyria/0001/0001_1.py
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+#第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
+import random
+import string
+
+def activation_code(chars = string.ascii_uppercase + string.digits, length=16):
+ return ''.join([random.choice(chars) for i in range(length)])
+
+if __name__ == '__main__':
+ code_collection = set()
+ for i in range(200):
+ code = activation_code()
+ if code not in code_collection:
+ code_collection.add(code)
+ else:
+ continue
diff --git a/pylyria/0004/0004.py b/pylyria/0004/0004.py
new file mode 100644
index 00000000..f174eb2d
--- /dev/null
+++ b/pylyria/0004/0004.py
@@ -0,0 +1,29 @@
+#! /usr/bin/env python
+#第 0004 题:任一个英文的纯文本文件,统计其中的单词出现的个数。
+# -*- coding: utf-8 -*-
+# vim:fenc=utf-8
+# Copyright By PyLyria
+# CreateTime: 2016-03-01 23:04:58
+
+import re
+from string import punctuation
+from operator import itemgetter
+
+def remove_punctuation(text):
+ text = re.sub(r'[{}]+'.format(punctuation), '', text)
+ return text.strip().lower()
+
+def split(file_name):
+ with open(file_name,'rt') as f:
+ lines = (line.strip() for line in f)
+ for line in lines:
+ yield re.split(r'[;,\s]\s*', line)
+
+if __name__ == '__main__':
+ word2count = {}
+ for line in split('chapter1.txt'):
+ words = (remove_punctuation(word) for word in line)
+ for word in words:
+ word2count[word] = word2count.get(word, 0) + 1
+ sorted_word2count = sorted(word2count.items(),key=itemgetter(0))
+ print(sorted_word2count)
diff --git a/pylyria/0005/0005.py b/pylyria/0005/0005.py
new file mode 100644
index 00000000..4900b5f5
--- /dev/null
+++ b/pylyria/0005/0005.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+#第 0005 题:你有一个目录,装了很多照片,把它们的尺寸变成都不大于 iPhone5 分辨率的大小。
+import os
+from PIL import Image
+
+def get_path(root = os.curdir):
+ root += os.sep
+ for path, dirs, files in os.walk(root):
+ for file_name in files:
+ yield path, file_name
+
+def get_size(width, heigh, max_width, max_heigh):
+ if width > max_width:
+ heigh = heigh * (max_width / width)
+ width = max_width
+ if heigh > max_heigh:
+ width = width * (max_heigh / heigh)
+ heigh = max_heigh
+ return width, heigh
+
+
+if __name__ == '__main__':
+ paths = get_path()
+ image_format = ('.jpg', '.jpeg', 'png', 'bmp')
+ max_size = (640, 1136)
+ for path, file_name in paths:
+ if file_name.endswith(image_format):
+ img = Image.open(path + os.sep + file_name)
+ size = get_size(*(img.size + max_size))
+ if size != img.size:
+ img.thumbnail(size)
+ img.save(path + os.sep + 'thumbnailed_' + file_name)
diff --git a/pylyria/0006/0006.py b/pylyria/0006/0006.py
new file mode 100644
index 00000000..0f500b38
--- /dev/null
+++ b/pylyria/0006/0006.py
@@ -0,0 +1,65 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+# vim:fenc=utf-8
+# Copyright By PyLyria
+# CreateTime: 2016-03-03 20:51:40
+import os
+import re
+import math
+import heapq
+from string import punctuation
+from operator import itemgetter
+
+def remove_punctuation(text):
+ text = re.sub(r'[{}]+'.format(punctuation), '', text)
+ return text.strip().lower()
+
+def split(file_name):
+ with open(file_name,'rt',encoding='utf-8') as f:
+ lines = (line.strip() for line in f)
+ for line in lines:
+ yield re.split(r'[;,\s]\s*', line)
+
+def get_path(root = os.curdir):
+ root += os.sep
+ for path, dirs, files in os.walk(root):
+ for file_name in files:
+ yield path, file_name
+
+def get_tf(file_name):
+ word2count = {}
+ for line in split(file_name):
+ words = (remove_punctuation(word) for word in line)
+ for word in words:
+ word2count[word] = word2count.get(word, 0) + 1
+ total = sum(word2count.values())
+ TF = {key : (value, value / total) for (key, value) in word2count.items()}
+ return TF
+
+def get_IDF(total_TF):
+ IDF = {}
+ for file_name in total_TF.keys():
+ for keyword in total_TF[file_name].keys():
+ IDF[keyword] = IDF.get(keyword, 0) + 1
+ IDF = {keyword: math.log(len(total_TF)/IDF[keyword], 2) for keyword in IDF.keys()}
+ return IDF
+
+def get_weight(TF, IDF):
+ weight = {key:TF[key][1]*IDF[key] for key in TF}
+ return weight
+
+if __name__ == '__main__':
+ paths = get_path()
+ format = ('.txt')
+ total_TF = {}
+ word_weight = {}
+
+ for path, file_name in paths:
+ if file_name.endswith(format):
+ total_TF[file_name] = get_tf(path + os.sep + file_name)
+
+ IDF = get_IDF(total_TF)
+
+ for file_name in total_TF.keys():
+ word_weight[file_name] = get_weight(total_TF[file_name], IDF)
+ print(heapq.nlargest(5, word_weight[file_name].items(), key=itemgetter(1)))
diff --git a/pylyria/0007/0007.py b/pylyria/0007/0007.py
new file mode 100644
index 00000000..b2c06f16
--- /dev/null
+++ b/pylyria/0007/0007.py
@@ -0,0 +1,37 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+# vim:fenc=utf-8
+# Copyright By PyLyria
+# CreateTime: 2016-03-04 19:36:40
+import os
+
+def get_path(root = os.curdir):
+ root += os.sep
+ for path, dirs, files in os.walk(root):
+ for file_name in files:
+ yield path, file_name
+
+def get_lines(file_name):
+ with open(file_name,'rt',encoding='utf-8') as f:
+ for line in f:
+ yield line.strip()
+
+if __name__ == '__main__':
+ paths = get_path()
+ format = ('.py', '.c', '.cpp', '.sql')
+ annotation = ('#', '//', '--', '/*')
+ code_statistics = {}
+
+ for path, file_name in paths:
+ if file_name.endswith(format):
+ code_statistics[file_name] = {}
+ lines = get_lines(path + os.sep + file_name)
+ for line in lines:
+ if len(line) ==0:
+ code_statistics[file_name]['EmptyLine'] = code_statistics[file_name].get('EmptyLine', 0) + 1
+ elif line.startswith(annotation):
+ code_statistics[file_name]['AnnotationLine'] = code_statistics[file_name].get('AnnotationLine', 0) + 1
+ else:
+ code_statistics[file_name]['CodeLine'] = code_statistics[file_name].get('CodeLine', 0) + 1
+
+ print(code_statistics)
diff --git a/pylyria/0008/0008.py b/pylyria/0008/0008.py
new file mode 100644
index 00000000..98805693
--- /dev/null
+++ b/pylyria/0008/0008.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+import os
+from html.parser import HTMLParser
+
+def get_path(root = os.curdir):
+ root += os.sep
+ for path, dirs, files in os.walk(root):
+ for file_name in files:
+ yield path, file_name
+
+class MyHTMLParser(HTMLParser):
+ def handle_starttag(self, tag, attrs):
+ TagStack.append(tag)
+
+ def handle_endtag(self, tag, tag_flag = True):
+ while tag_flag == True:
+ if tag == TagStack[-1]:
+ TagStack.pop()
+ tag_flag = False
+ else:
+ TagStack.pop()
+
+ def handle_data(self, data):
+ if data.strip() and "body" in TagStack and "p" in TagStack:
+ body.append(data.strip())
+
+if __name__ == '__main__':
+ paths = get_path()
+ html_format = ('.html','.htm')
+ TagStack = []
+ parser = MyHTMLParser()
+ body = []
+
+ for path, file_name in paths:
+ if file_name.endswith(html_format):
+ parser.feed(open(path + os.sep + file_name, encoding='utf-8').read())
+
+ print(body)
diff --git a/pylyria/0009/0009.py b/pylyria/0009/0009.py
new file mode 100644
index 00000000..8afe47a8
--- /dev/null
+++ b/pylyria/0009/0009.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+import os
+from html.parser import HTMLParser
+
+def get_path(root = os.curdir):
+ root += os.sep
+ for path, dirs, files in os.walk(root):
+ for file_name in files:
+ yield path, file_name
+
+class MyHTMLParser(HTMLParser):
+ def handle_starttag(self, tag, attrs):
+ TagStack.append(tag)
+ if tag == 'a':
+ for name, value in attrs:
+ if name == 'href':
+ link.append((value, 'None'))
+
+ def handle_endtag(self, tag, tag_flag = True):
+ while tag_flag == True:
+ if tag == TagStack[-1]:
+ TagStack.pop()
+ tag_flag = False
+ else:
+ TagStack.pop()
+
+ def handle_data(self, data):
+ if data.strip() and 'body' in TagStack and 'a' in TagStack:
+ link[-1] = (link[-1][0], data.strip())
+
+if __name__ == '__main__':
+ paths = get_path()
+ html_format = ('.html','.htm')
+ TagStack = []
+ parser = MyHTMLParser()
+ link = []
+
+ for path, file_name in paths:
+ if file_name.endswith(html_format):
+ parser.feed(open(path + os.sep + file_name, encoding='utf-8').read())
+
+ print(link)
diff --git a/pylyria/0010/0010.py b/pylyria/0010/0010.py
new file mode 100644
index 00000000..0763eca6
--- /dev/null
+++ b/pylyria/0010/0010.py
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+import random
+import string
+from PIL import Image, ImageFont, ImageDraw, ImageFilter
+
+def create_strs(draw, chars, length, font_type, font_size, width, height, fg_color):
+ c_chars = ''.join([random.choice(chars) for i in range(length)])
+ font = ImageFont.truetype(font_type, font_size)
+ x0 = 9
+ for c in c_chars:
+ xt = random.randint(0, font_size / 3)
+ yt = random.randint(2, 6)
+ draw.text((x0 + xt, yt), c, font = font, fill = fg_color)
+ x0 = x0 + xt + font_size
+ return c_chars
+
+def create_lines(draw, n_line, width, height):
+ line_num = random.randint(n_line[0],n_line[1])
+ for i in range(line_num):
+ begin = (random.randint(0, width), random.randint(0, height))
+ end = (random.randint(0, width), random.randint(0, height))
+ draw.line([begin, end], fill=(0, 0, 0))
+
+def create_points(draw, point_chance, width, height):
+ chance = min(100, max(0, int(point_chance)))
+ for w in range(width):
+ for h in range(height):
+ tmp = random.randint(0, 100)
+ if tmp > 100 - chance:
+ draw.point((w, h), fill = (0, 0, 0))
+
+def valiadate_img(
+ size = (120, 30),
+ chars = string.ascii_uppercase,
+ img_type = 'PNG',
+ mode = 'RGB',
+ bg_color = (random.randint(128, 255), random.randint(128, 255), random.randint(128, 255)),
+ fg_color = (random.randint(0, 128), random.randint(0, 128), random.randint(0, 128)),
+ font_size = 18,
+ font_type = 'arial.ttf',
+ length = 4,
+ draw_lines = True,
+ n_line = (1, 2),
+ draw_points = True,
+ point_chance = 2):
+ width, height = size
+ img = Image.new(mode, size, bg_color)
+ draw = ImageDraw.Draw(img)
+ if draw_lines:
+ create_lines(draw, n_line, width, height)
+ if draw_points:
+ create_points(draw, point_chance, width, height)
+ strs = create_strs(draw, chars, length, font_type, font_size, width, height, fg_color)
+
+ params = [
+ 1 - float(random.randint(1, 2) / 100),
+ 0,
+ 0,
+ 0,
+ 1 - float(random.randint(1, 10) / 100),
+ float(random.randint(1, 2) / 500),
+ 0.001,
+ float(random.randint(1, 2) / 500)]
+
+ img = img.transform(size, Image.PERSPECTIVE, params)
+
+ img = img.filter(ImageFilter.EDGE_ENHANCE_MORE)
+
+ return img, strs
+
+if __name__ == "__main__":
+ code_img = valiadate_img()
+ code_img[0].save("validate.png", "GIF")
+ print(code_img[1])
diff --git a/pylyria/0011/0011.py b/pylyria/0011/0011.py
new file mode 100644
index 00000000..38de53b1
--- /dev/null
+++ b/pylyria/0011/0011.py
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+
+def is_sensitive(word):
+ sensitive_words = [line.strip() for line in open('sensitive.txt', encoding='utf-8')]
+ word = word.strip()
+ if word.lower() in sensitive_words:
+ return True
+ else:
+ return False
+
+if __name__ == "__main__":
+ while 1:
+ if is_sensitive(input()):
+ print('Freedom')
+ else:
+ print('Human Rights')
diff --git a/pylyria/0012/0012.py b/pylyria/0012/0012.py
new file mode 100644
index 00000000..eadd22be
--- /dev/null
+++ b/pylyria/0012/0012.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+import re
+
+def sensitive_test(word):
+ sensitive_words = [line.strip() for line in open('sensitive.txt', encoding='utf-8')]
+ word = word.strip()
+ for sensitive_word in sensitive_words:
+ if sensitive_word.strip() in word.lower():
+ word = re.sub(sensitive_word, '*' * len(sensitive_word), word, flags=re.IGNORECASE)
+ return word
+
+if __name__ == "__main__":
+ line = True
+ while line:
+ line = input()
+ line = line.strip()
+ print(sensitive_test(line))
diff --git a/pylyria/0013/0013.py b/pylyria/0013/0013.py
new file mode 100644
index 00000000..f2abd6e3
--- /dev/null
+++ b/pylyria/0013/0013.py
@@ -0,0 +1,23 @@
+from urllib.error import URLError, HTTPError
+import urllib.request
+import urllib.parse
+
+url = 'http://tieba.baidu.com/p/2166231880'
+values={'wd':'python',
+ 'opt-webpage':'on',
+ 'ie':'gbk'}
+url_values=urllib.parse.urlencode(values)
+#print(url_values)
+
+url_values=url_values.encode(encoding='UTF8')
+full_url=urllib.request.Request(url,url_values)
+#or ony one sentense:full_url=url+'?'+url_values
+
+try:
+ response=urllib.request.urlopen(full_url) #open=urlopen
+except HTTPError as e:
+ print('Error code:',e.code)
+except URLError as e:
+ print('Reason',e.reason)
+the_page=response.read()
+print(the_page)
diff --git a/python b/python
index d989ede3..4ae3b1cc 160000
--- a/python
+++ b/python
@@ -1 +1 @@
-Subproject commit d989ede362d8938f44dbf7358ec935823a32e9cd
+Subproject commit 4ae3b1cc45266a9a769960696ead49087cc02cd3
diff --git a/robot527/0011/word_filter.py b/robot527/0011/word_filter.py
new file mode 100644
index 00000000..346195f3
--- /dev/null
+++ b/robot527/0011/word_filter.py
@@ -0,0 +1,54 @@
+#! /usr/bin/python
+# -*- coding: utf-8 -*-
+# word_filter.py
+# author: robot527
+# created at 2016-4-22
+
+'''
+дıļ filtered_words.txtΪÿһһдʡ
+ûдʱӡ Freedomӡ Human Rights
+'''
+
+def get_words(words_file):
+ '''Get words from words_file'''
+ words = []
+ text = open(words_file)
+ for each_line in text:
+ words.append(each_line.strip().decode('gb18030'))
+ #for w in words:
+ # print w, type(w)
+ text.close()
+ return words
+
+
+def str_to_unicode(str1):
+ '''Convert str1 to unicode'''
+ if isinstance(str1, unicode):
+ return str1
+ try:
+ string_uni = str1.decode("utf-8")
+ return string_uni
+ except UnicodeDecodeError as err:
+ print err
+
+
+if __name__ == '__main__':
+ sensitive_words = get_words("filtered_words.txt")
+ running = True
+ while running:
+ print 'Please input a word, or press q for exit.'
+ try:
+ para = raw_input("-> ")
+ except EOFError:
+ print "If you want to quit, press Q key.\n"
+ continue
+ #uw = str_to_unicode(para)
+ #print uw, type(uw)
+ if str_to_unicode(para) in sensitive_words:
+ print "Freedom\n"
+ elif para is 'q':
+ para = raw_input("Do you really want to exit ([y]/n)?")
+ if para is not 'n':
+ running = False
+ else:
+ print "Human Rights\n"
diff --git a/robot527/0012/filtered_words.txt b/robot527/0012/filtered_words.txt
new file mode 100644
index 00000000..1b4f2244
--- /dev/null
+++ b/robot527/0012/filtered_words.txt
@@ -0,0 +1,11 @@
+北京
+程序员
+公务员
+领导
+牛比
+牛逼
+你娘
+你妈
+love
+sex
+jiangge
diff --git a/robot527/0012/shield_sensitive_words.py b/robot527/0012/shield_sensitive_words.py
new file mode 100644
index 00000000..689aeb3e
--- /dev/null
+++ b/robot527/0012/shield_sensitive_words.py
@@ -0,0 +1,61 @@
+#! /usr/bin/python
+# -*- coding: utf-8 -*-
+# shield_sensitive_words.py
+# author: robot527
+# created at 2016-4-26
+
+'''
+дıļ filtered_words.txtΪÿһһдʡ
+
+Ա
+Ա
+쵼
+ţ
+ţ
+
+
+love
+sex
+jiangge
+
+ûдʱǺ * 滻
+統û롸ǸóСɡ**ǸóС
+'''
+
+def get_replace_str(word):
+ '''Generate word replace string for word'''
+ if word.isalnum():
+ return '*' * len(word)
+ else:
+ return '*' * (len(word) / 3)
+
+
+def get_words_dict(words_file):
+ '''Generate word replace dictionary from words_file'''
+ words = {}
+ text = open(words_file)
+ for each_line in text:
+ word = each_line.strip()
+ words[word] = get_replace_str(word)
+ text.close()
+ return words
+
+
+if __name__ == '__main__':
+ sensitive_words = get_words_dict("filtered_words.txt")
+ running = True
+ while running:
+ print 'Please input a sentence, or press q for exit.'
+ try:
+ para = raw_input("-> ")
+ except EOFError:
+ print "If you want to quit, press Q key.\n"
+ continue
+ if para is 'q':
+ para = raw_input("Do you really want to exit ([y]/n)?")
+ if para is not 'n':
+ running = False
+ else:
+ for each in sensitive_words.keys():
+ para = para.replace(each, sensitive_words[each])
+ print para, '\n'
diff --git a/rosalesjahaziel/0001/0001.py b/rosalesjahaziel/0001/0001.py
new file mode 100644
index 00000000..1c0511b5
--- /dev/null
+++ b/rosalesjahaziel/0001/0001.py
@@ -0,0 +1,12 @@
+import random
+import string
+
+
+# this method use the 'key' to select 10 random characters
+def generateCode(count):
+ for code in range(count):
+ key = string.upper('0123456789abcefghijklmnopqrstuvwxyz')
+ code = string.join(random.sample(key, 10))
+ print(code)
+
+generateCode(10) # generate the amount of codes you send as count
diff --git a/rusia-rak/README.md b/rusia-rak/README.md
new file mode 100644
index 00000000..dd7399f2
--- /dev/null
+++ b/rusia-rak/README.md
@@ -0,0 +1,5 @@
+# My Repository
+
+View my solutions through the url below.
+
+https://github.com/rusia-rak/My-Solutions-For-Show-Me-The-Code
diff --git a/sandeepbvv11/0001/0001.py b/sandeepbvv11/0001/0001.py
new file mode 100644
index 00000000..dc07ddaa
--- /dev/null
+++ b/sandeepbvv11/0001/0001.py
@@ -0,0 +1,13 @@
+import uuid
+import random
+st= 'qwertyuiopasdfghjklzxcvbnm!@#$%^&*'
+for i in range(0,200):
+ x=str(uuid.uuid4().fields[-1])[:10]+st
+ y=''
+ for j in range(0,10):
+ y+=random.choice(x)
+ print (y+"\n")
+
+
+
+
diff --git a/sandeepbvv11/0001/IDs.txt b/sandeepbvv11/0001/IDs.txt
new file mode 100644
index 00000000..072c81b2
--- /dev/null
+++ b/sandeepbvv11/0001/IDs.txt
@@ -0,0 +1,200 @@
+1633080030
+1575331450
+2576272470
+6025196078
+6749800715
+1809784356
+1103067567
+2317154466
+2387172619
+1311479942
+2177631153
+2370287260
+1162412523
+2518779639
+2243750316
+1938180132
+1591366150
+6188050497
+2740704135
+1600959530
+2659057887
+2345262636
+3739990209
+2002762930
+1917284190
+2693778613
+2709103722
+5489642575
+1876898180
+1238515989
+4165697613
+8088099212
+2724793887
+2049639056
+1104856673
+9166531473
+9282269858
+1448264591
+1386139747
+1065576292
+4204557152
+2512295415
+1050894477
+2524912544
+6692710623
+2616827417
+7458305235
+1044794447
+5098747466
+2797008072
+7724293396
+1111770796
+1461006658
+8989839708
+6913737732
+2187806510
+2698293925
+5016785151
+2603392454
+2409248575
+2154409098
+2334854535
+7242170605
+6087847902
+1868083093
+1558536908
+2686827506
+2053548015
+8415640657
+9152960105
+1633827298
+1584236906
+5785050546
+7180274223
+1765903205
+1337873601
+1780907326
+1822360329
+6926443396
+7399201643
+1928861800
+1134654553
+1320384102
+2233968778
+1455518823
+2517263032
+1169422273
+1716334763
+1161051209
+2015915750
+1172222839
+1986125462
+2691761365
+5616099885
+1339589794
+1698316598
+1646543965
+1149678559
+1694897607
+2748354798
+6778102246
+6210771279
+1843697405
+1157328700
+2311701369
+2354728221
+1676462923
+1406252700
+8164346992
+1597080590
+2087121727
+2581425250
+2360763824
+2719496354
+1996551439
+2307124705
+1590380101
+2033501264
+2074669740
+4330833648
+6876615313
+2197033238
+1706630780
+1492489223
+2756620317
+1879142971
+5121975454
+8565292030
+2725313491
+2916240089
+2784487922
+9672375423
+2156919306
+4857227306
+2140172516
+6028740948
+1783900706
+3855460378
+2743825061
+8344693520
+7227242087
+1276410280
+8338154889
+1404111534
+1466184954
+2368850546
+2688854049
+2481429282
+2632295224
+4492399381
+2231034178
+1575661525
+1557617235
+2673273294
+1186634339
+2078658558
+2557116528
+2147464885
+1493314057
+1016852420
+1231533029
+1363504328
+5751842538
+3130274956
+1762953006
+1919187578
+1613396255
+2140266457
+1252506424
+1718690455
+3714816841
+3729165890
+1709638350
+2553647887
+2422430080
+7186739897
+5175743127
+1939180977
+2387691619
+7026319394
+2126033877
+5044248245
+1304451862
+7791137498
+6527058140
+2529986191
+7005348341
+2561005708
+8121959066
+5634593318
+9063187949
+6972178424
+1903659460
+8855566396
+1085528406
+8036753003
+2057399339
+1136500130
+7911266804
+1021556078
diff --git a/sarikasama/0000/0000.py b/sarikasama/0000/0000.py
new file mode 100644
index 00000000..c5c0815c
--- /dev/null
+++ b/sarikasama/0000/0000.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+#Add a number on my icon with the name "icon.png".
+#My icon is a little ... big.
+#Problem0000
+
+from PIL import Image, ImageDraw, ImageFont
+
+def add_number(num):
+ im = Image.open("icon.png")
+ #make a image for showing the number
+ txt = Image.new('RGBA', im.size, (255,255,255,0))
+ #use the font "arial.ttf"
+ fnt = ImageFont.truetype("arial.ttf",40)
+ #draw context
+ d = ImageDraw.Draw(txt)
+ #draw the number
+ d.text((im.size[0]-50 ,5), str(num), font=fnt, fill=(255,0,0,255))
+
+ out = Image.alpha_composite(im, txt)
+ out.show()
+ out.save("icon_"+str(num)+".png")
+
+if __name__ == '__main__':
+ add_number(42)
diff --git a/sarikasama/0000/arial.ttf b/sarikasama/0000/arial.ttf
new file mode 100644
index 00000000..7ff88f22
Binary files /dev/null and b/sarikasama/0000/arial.ttf differ
diff --git a/sarikasama/0000/icon.png b/sarikasama/0000/icon.png
new file mode 100644
index 00000000..b8e21672
Binary files /dev/null and b/sarikasama/0000/icon.png differ
diff --git a/sarikasama/0000/icon_42.png b/sarikasama/0000/icon_42.png
new file mode 100644
index 00000000..656e1adc
Binary files /dev/null and b/sarikasama/0000/icon_42.png differ
diff --git a/sarikasama/0001/0001.py b/sarikasama/0001/0001.py
new file mode 100644
index 00000000..51cbb023
--- /dev/null
+++ b/sarikasama/0001/0001.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python3
+#generate 200 activation codes for my apple store app
+
+import random, string
+
+def gene_activation_code(count, length):
+ #make sure codes are diffrent
+ res = set()
+ while len(res) < count:
+ res.add(''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length)))
+ return res
+
+if __name__ == "__main__":
+ res = gene_activation_code(200, 8)
+ f = open("codes","w")
+ f.write("\n".join(res))
+ f.close()
diff --git a/sarikasama/0001/codes b/sarikasama/0001/codes
new file mode 100644
index 00000000..88130bcf
--- /dev/null
+++ b/sarikasama/0001/codes
@@ -0,0 +1,200 @@
+9HM28I2V
+YUTUSWLX
+KO910ZXR
+1XQ7OMTH
+R8B8XWT3
+CAZDMATI
+HNHAU3QA
+VR2A5O8L
+1A2TG34C
+X3JT0T0B
+H4LSILG3
+BCICBNNJ
+LUFUT2S0
+4H51EV7M
+WMHE0LX1
+LBO6B5U7
+EJG3J6ZZ
+YQCQV5IS
+3SEL07K3
+N288TJEL
+VFCC0K2B
+P8J9ZG5N
+TDY65TGQ
+JGR14QYY
+012QG5J7
+JJD09E6O
+1V6QXSND
+MITES6G1
+V3C09ACE
+2I84H8D9
+ZR9VA4OR
+0J8VTCFY
+XCBB9HWF
+GS1NL6UB
+70GO84CW
+T1V48W99
+H4L9PCSG
+0XSXAQT0
+D7J98ZSY
+IKB10A5S
+VQGZ5L4C
+WJU2IMH8
+0XTNP65W
+XQ671726
+LCIMNOH4
+R36ZXNGT
+NU04BJOR
+P2IJVBEP
+JT1SCFZC
+69Y6VQ7A
+V5D5G6X2
+9GCKGK6M
+UB5G5OHX
+BGA0KKP6
+6V5TSJ58
+570VS9I6
+E03UJCOB
+J2UCMXGT
+8J7XBKU4
+MIJJDS35
+TCJFR4OU
+AT1M8RXF
+6G7PZVXU
+9601SLTJ
+G585YO17
+FOO71FXH
+N4TM1W45
+D0UZGV1C
+3X44O8AC
+A89NHFE7
+9PRH0BYM
+JFC3X18B
+HXBZY6DL
+2S3LZAPT
+HX572VEB
+WX0W7R99
+VKYBQBRI
+ZDU36TBC
+4L4EU1Y5
+TEBGN81Y
+BDJFCK9I
+SXA2D5EZ
+FCG7VJN0
+MWIEFAM2
+E8TO1EY5
+1JRU6F31
+7N70U7N7
+CSIWDBUK
+VQ8KR73I
+ISHABRX5
+2TXRGDJ8
+Z90BQBSG
+WSBJ4X3L
+34EKGUR8
+A63CJ0F0
+4QJ9TB49
+PTVLGUF3
+A9B0PY0K
+ZVP29VCK
+K3H9331J
+21HG6P11
+W6GZAVVD
+I5HGBM6P
+8RTCLY8R
+5A860OIH
+VLN2ZB37
+7DRYVPHU
+FWI0HDAD
+6P9RGQ8Z
+7F9Q10FR
+7HNH3EWP
+PFHK18Z6
+5VS9PKLC
+AZMBWSKW
+XA30TWRJ
+V6HI00G4
+A385GB8L
+1UFF62RI
+3TL6B4D4
+JYWHW6EY
+JZ7X5R31
+FG51SGUY
+Z7YTXLGF
+J3AVBX3P
+FNV19XYR
+M3I2Q6EV
+YY35QIOS
+J2BMJVP3
+XW9HM2HB
+1873CQQ8
+KGL61SL7
+TU41J8F4
+U1UCSYE5
+4L45MMQ9
+MFQLY7CB
+MKFH50ZZ
+LQ44DAW9
+8599GTIB
+IGCT34SA
+Q39B1TOJ
+LANF45HH
+72PJTWPK
+F0XPL1ZO
+5U7KOGZ9
+6M1MMXZ1
+HVZQD6RB
+H2D50E2W
+WJEXAK1L
+I4CBC1W5
+X9XRXBS3
+DBNDT60B
+6C6QJW0V
+H8J8ZW8D
+64MUB2X0
+8R44E4P9
+R83AV775
+UBRSJBPF
+JN36LDJW
+3C2EEMIQ
+HRE1S0SK
+SH8QH70P
+3BI5Q1ZF
+1VAQQXA0
+QGY6Y7G6
+1QQ9FLV7
+AP1SNJP2
+G68VA57Y
+N6UHT54O
+7Q9BB5JL
+B4PIP9CJ
+BAS3O1FH
+L6Q6YVSH
+APRT16IN
+K4205WGU
+R00E9H6L
+6MW091Y5
+ERCE510B
+U8XKOESQ
+1YAXZEFB
+KESINTFI
+03DUWJYK
+VRFUU0ZR
+F5E4B6FX
+XSEBU1JQ
+3E692DCL
+SF5A49NX
+7P73NY4S
+FAI8YPYC
+TDA6FHLT
+1NIX4S8W
+R549CDKZ
+CHK907PO
+5S8BU9CN
+XJIK45B5
+PK1PKL3K
+UDU54DY7
+G863ES4G
+GNW10XUX
+FEBRWV5F
+88I6TN3R
\ No newline at end of file
diff --git a/sarikasama/0004/0004.py b/sarikasama/0004/0004.py
new file mode 100644
index 00000000..864fbfd2
--- /dev/null
+++ b/sarikasama/0004/0004.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+#count words in a textfile
+
+from pprint import pprint
+import re
+
+def main():
+ res = {}
+ with open('test','r') as f:
+ content = f.read()
+ tmp = re.split(r"[^a-zA-Z]",content)
+ for w in tmp:
+ if not w:
+ continue
+ w = w.lower()
+ if w not in res:
+ res[w] = 1
+ else:
+ res[w] += 1
+ pprint(res)
+
+if __name__ == "__main__":
+ main()
diff --git a/sarikasama/0004/output b/sarikasama/0004/output
new file mode 100644
index 00000000..2bd14c75
--- /dev/null
+++ b/sarikasama/0004/output
@@ -0,0 +1,107 @@
+{'a': 5,
+ 'about': 1,
+ 'age': 1,
+ 'all': 1,
+ 'always': 2,
+ 'an': 1,
+ 'and': 1,
+ 'arms': 1,
+ 'as': 2,
+ 'at': 4,
+ 'been': 1,
+ 'before': 1,
+ 'born': 1,
+ 'but': 1,
+ 'by': 1,
+ 'can': 1,
+ 'child': 1,
+ 'count': 1,
+ 'did': 3,
+ 'dolly': 1,
+ 'dolores': 1,
+ 'dotted': 1,
+ 'down': 1,
+ 'envied': 1,
+ 'exhibit': 1,
+ 'fact': 1,
+ 'fancy': 1,
+ 'feet': 1,
+ 'fire': 1,
+ 'for': 1,
+ 'four': 1,
+ 'gentlemen': 1,
+ 'girl': 1,
+ 'had': 1,
+ 'have': 2,
+ 'i': 1,
+ 'in': 6,
+ 'indeed': 1,
+ 'initial': 1,
+ 'is': 1,
+ 'jury': 1,
+ 'ladies': 1,
+ 'lee': 2,
+ 'life': 1,
+ 'light': 1,
+ 'line': 1,
+ 'lo': 4,
+ 'loins': 1,
+ 'lola': 1,
+ 'lolita': 4,
+ 'look': 1,
+ 'loved': 1,
+ 'many': 1,
+ 'might': 1,
+ 'misinformed': 1,
+ 'morning': 1,
+ 'murderer': 1,
+ 'my': 6,
+ 'no': 1,
+ 'noble': 1,
+ 'not': 1,
+ 'number': 1,
+ 'of': 7,
+ 'oh': 1,
+ 'on': 3,
+ 'one': 3,
+ 'palate': 1,
+ 'plain': 1,
+ 'point': 1,
+ 'precursor': 1,
+ 'princedom': 1,
+ 'prose': 1,
+ 'school': 1,
+ 'sea': 1,
+ 'seraphs': 2,
+ 'she': 8,
+ 'simple': 1,
+ 'sin': 1,
+ 'slacks': 1,
+ 'sock': 1,
+ 'soul': 1,
+ 'standing': 1,
+ 'steps': 1,
+ 'style': 1,
+ 'summer': 2,
+ 'ta': 2,
+ 'taking': 1,
+ 'tangle': 1,
+ 'tap': 1,
+ 'teeth': 1,
+ 'ten': 1,
+ 'that': 1,
+ 'the': 10,
+ 'there': 1,
+ 'this': 1,
+ 'thorns': 1,
+ 'three': 2,
+ 'tip': 1,
+ 'to': 1,
+ 'tongue': 1,
+ 'trip': 1,
+ 'was': 7,
+ 'what': 1,
+ 'when': 1,
+ 'winged': 1,
+ 'years': 1,
+ 'you': 1}
diff --git a/sarikasama/0004/test b/sarikasama/0004/test
new file mode 100644
index 00000000..c18efc11
--- /dev/null
+++ b/sarikasama/0004/test
@@ -0,0 +1 @@
+Lolita, light of my life, fire of my loins. My sin, my soul. Lo-lee-ta: the tip of the tongue taking a trip of three steps down the palate to tap, at three, on the teeth. Lo. Lee. Ta. She was Lo, plain Lo, in the morning, standing four feet ten in one sock. She was Lola in slacks. She was Dolly at school. She was Dolores on the dotted line. But in my arms she was always Lolita. Did she have a precursor? She did, indeed she did. In point of fact, there might have been no Lolita at all had I not loved, one summer, an initial girl-child. In a princedom by the sea. Oh when? About as many years before Lolita was born as my age was that summer. You can always count on a murderer for a fancy prose style. Ladies and gentlemen of the jury, exhibit number one is what the seraphs, the misinformed, simple, noble-winged seraphs, envied. Look at this tangle of thorns.
\ No newline at end of file
diff --git a/sarikasama/0005/0005.py b/sarikasama/0005/0005.py
new file mode 100644
index 00000000..8d275531
--- /dev/null
+++ b/sarikasama/0005/0005.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+#change the resolution of pics in dir 'test' to at most 1136*640 for iphone5
+from PIL import Image
+import os
+
+def main():
+ os.chdir('test')
+ for root,dirs,files in os.walk(os.getcwd()):
+ for f in files:
+ im = Image.open(f)
+ if im.size[0] > 1136:
+ im.resize([1136,im.size[1]])
+ if im.size[1] > 640:
+ im.resize([im.size[0],640])
+ im.save('test_'+im.filename)
+
+if __name__=='__main__':
+ main()
diff --git a/sarikasama/0006/0006.py b/sarikasama/0006/0006.py
new file mode 100644
index 00000000..66823951
--- /dev/null
+++ b/sarikasama/0006/0006.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python3
+#get the most important word in the text
+
+import os, re
+from pprint import pprint
+
+def most_important_word(f):
+ #get the count of words in the text
+ res = {}
+ content = f.read()
+ tmp = re.split(r"[^a-zA-Z]",content)
+ for w in tmp:
+ if not w:
+ continue
+ w = w.lower()
+ if w not in res:
+ res[w] = 1
+ else:
+ res[w] += 1
+
+ #get the word of most importance
+ res['']=0
+ max = ''
+ for i in res:
+ if res[i] > res[max]:
+ max = i
+ return max
+
+def main():
+ res = {}
+ os.chdir('test')
+ for root,dirs,files in os.walk(os.getcwd()):
+ for file in files:
+ with open(file,'r') as f:
+ res[f.name]=most_important_word(f)
+ return res
+
+if __name__ == "__main__":
+ res = main()
+ pprint(res)
diff --git a/sarikasama/0007/0007.py b/sarikasama/0007/0007.py
new file mode 100644
index 00000000..ba8c417a
--- /dev/null
+++ b/sarikasama/0007/0007.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+#count lines of code in directory 'test'
+
+import os
+
+def count_lines(f):
+ #get the count of lines in the code
+ total = note = empty_row = 0
+ line = f.readline()
+ while line != '':
+ if line[0] == '#':
+ note += 1
+ total += 1
+ elif line == '\n':
+ empty_row += 1
+ total += 1
+ else:
+ total += 1
+ line = f.readline()
+ return total, note, empty_row
+
+def main():
+ res = {}
+ os.chdir('test')
+ for root,dirs,files in os.walk(os.getcwd()):
+ for file in files:
+ with open(file,'r') as f:
+ res[f.name]=count_lines(f)
+ return res
+
+if __name__=="__main__":
+ res = main()
+ for i in res:
+ print(i+"\ntotal:"+str(res[i][0])+"\nnote:"+str(res[i][1])+"\nempty_line:"+str(res[i][2]))
+ print("\n")
diff --git a/sarikasama/0008/0008.py b/sarikasama/0008/0008.py
new file mode 100644
index 00000000..1f50c6dc
--- /dev/null
+++ b/sarikasama/0008/0008.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env pyhton3
+#get the text in a html file
+
+import re, urllib.request
+
+def get_text(url):
+ content = url.read()
+ try:
+ content = content.decode('utf-8')
+ except:
+ content = content.decode('gbk')
+
+ content = re.sub(r'', '', content, flags = re.DOTALL)
+ content = re.sub(r'', '', content, flags = re.DOTALL)
+ content = re.sub(r'', '', content, flags = re.DOTALL)
+ content = re.sub(r'<[^>]*>', '', content)
+ content = re.sub(r'\n', '', content)
+
+ print(content)
+
+def main():
+ with urllib.request.urlopen('http://thwiki.cc/') as url:
+ get_text(url)
+
+if __name__ == '__main__':
+ main()
diff --git a/sarikasama/0009/0009.py b/sarikasama/0009/0009.py
new file mode 100644
index 00000000..454f1460
--- /dev/null
+++ b/sarikasama/0009/0009.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env pyhton3
+#get the link in a html file
+
+import re, urllib.request
+from lxml.html import parse
+
+def get_link(url):
+ dom = parse(url).getroot()
+ links = dom.xpath('//a')
+ for link in links:
+ link = link
+ try:
+ print(link.attrib['href'])
+ except:
+ pass
+
+if __name__ == '__main__':
+ get_link('http://thwiki.cc/')
diff --git a/sarikasama/0010/0010.py b/sarikasama/0010/0010.py
new file mode 100644
index 00000000..01125d7b
--- /dev/null
+++ b/sarikasama/0010/0010.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+#generate random verification codes in letters
+
+import random, string
+from PIL import Image, ImageDraw, ImageFont, ImageFilter
+
+def gene_verification_code_pic():
+ #initialize
+ im = Image.new('RGB', (200, 50), (255, 255, 255))
+ font = ImageFont.truetype('arial.ttf', 30)
+ draw = ImageDraw.Draw(im)
+
+ #init background with light color
+ for i in range(200):
+ for j in range(50):
+ draw.point((i, j), fill=(random.randint(128,255),random.randint(128,255),random.randint(128,255)))
+
+ #init letters with deep color
+ for t in range(4):
+ draw.text((50*t+10, 10), random.choice(string.ascii_letters), font=font, fill=(random.randint(0,127), random.randint(0,127), random.randint(0,127)))
+
+ #make the pic blurred
+ im = im.filter(ImageFilter.BLUR)
+ return im
+
+if __name__ == '__main__':
+ im = gene_verification_code_pic()
+ im.show()
+ im.save('res.jpg')
diff --git a/sarikasama/0010/arial.ttf b/sarikasama/0010/arial.ttf
new file mode 100644
index 00000000..7ff88f22
Binary files /dev/null and b/sarikasama/0010/arial.ttf differ
diff --git a/sarikasama/0010/res.jpg b/sarikasama/0010/res.jpg
new file mode 100644
index 00000000..e079b88c
Binary files /dev/null and b/sarikasama/0010/res.jpg differ
diff --git a/sarikasama/0011/0011.py b/sarikasama/0011/0011.py
new file mode 100644
index 00000000..c105c831
--- /dev/null
+++ b/sarikasama/0011/0011.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+#filter sensitive words in user's input
+
+def filter_sensitive_words(input_word):
+ s_words = []
+ with open('filtered_words','r') as f:
+ line = f.readline()
+ while line != '':
+ s_words.append(line.strip())
+ line = f.readline()
+ if input_word in s_words:
+ print("Freedom")
+ else:
+ print("Human Rights")
+
+if __name__ == '__main__':
+ while True:
+ input_word = input('--> ')
+ filter_sensitive_words(input_word)
diff --git a/sarikasama/0011/filtered_words b/sarikasama/0011/filtered_words
new file mode 100644
index 00000000..f0da7ccc
--- /dev/null
+++ b/sarikasama/0011/filtered_words
@@ -0,0 +1,11 @@
+北京
+程序员
+公务员
+领导
+牛比
+牛逼
+你娘
+你妈
+love
+sex
+ jiangge
diff --git a/sarikasama/0012/0012.py b/sarikasama/0012/0012.py
new file mode 100644
index 00000000..df193d81
--- /dev/null
+++ b/sarikasama/0012/0012.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+#filter sensitive words in user's input
+
+def replace_sensitive_words(input_word):
+ s_words = []
+ with open('filtered_words','r') as f:
+ line = f.readline()
+ while line != '':
+ s_words.append(line.strip())
+ line = f.readline()
+ for word in s_words:
+ if word in input_word:
+ input_word = input_word.replace(word, "**")
+ print(input_word)
+
+if __name__ == '__main__':
+ while True:
+ input_word = input('--> ')
+ replace_sensitive_words(input_word)
diff --git a/sarikasama/0012/filtered_words b/sarikasama/0012/filtered_words
new file mode 100644
index 00000000..f0da7ccc
--- /dev/null
+++ b/sarikasama/0012/filtered_words
@@ -0,0 +1,11 @@
+北京
+程序员
+公务员
+领导
+牛比
+牛逼
+你娘
+你妈
+love
+sex
+ jiangge
diff --git a/sarikasama/0013/0013.py b/sarikasama/0013/0013.py
new file mode 100644
index 00000000..76ee61a1
--- /dev/null
+++ b/sarikasama/0013/0013.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#get all pic in a url
+
+from urllib.request import urlopen
+from bs4 import BeautifulSoup
+
+def img_crawler(url):
+ content = url.read()
+ bs_object = BeautifulSoup(content)
+ bs_imgs = bs_object.find_all('img', pic_type='0')
+
+ for img in bs_imgs:
+ img_url = img['src']
+ try:
+ img_content = urlopen(img_url).read()
+ except:
+ pass
+ print("Downloading... "+img_url)
+ img_f = open(img_url.split('/')[-1], 'wb')
+ img_f.write(img_content)
+ img_f.close()
+ print("Complete!")
+
+if __name__ == '__main__':
+ url = urlopen('http://tieba.baidu.com/p/2166231880')
+ img_crawler(url)
diff --git a/sarikasama/0014/0014.py b/sarikasama/0014/0014.py
new file mode 100644
index 00000000..6d082f91
--- /dev/null
+++ b/sarikasama/0014/0014.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+#from json to xlsx
+
+import xlsxwriter, json
+
+def json2xls():
+ wb = xlsxwriter.Workbook('student.xls')
+ ws = wb.add_worksheet("student")
+
+ with open('./student') as f:
+ data = json.load(f)
+ for i in range(len(data)):
+ ws.write(i, 0, i+1)
+ json_data = data[str(i+1)]
+ for j in range(len(json_data)):
+ ws.write(i, j+1, json_data[j])
+ wb.close()
+
+if __name__=='__main__':
+ json2xls()
diff --git a/sarikasama/0014/student b/sarikasama/0014/student
new file mode 100644
index 00000000..1c4ffe6d
--- /dev/null
+++ b/sarikasama/0014/student
@@ -0,0 +1,5 @@
+{
+ "1":["张三",150,120,100],
+ "2":["李四",90,99,95],
+ "3":["王五",60,66,68]
+}
diff --git a/sarikasama/0014/student.xls b/sarikasama/0014/student.xls
new file mode 100644
index 00000000..8575f90c
Binary files /dev/null and b/sarikasama/0014/student.xls differ
diff --git a/sarikasama/0015/0015.py b/sarikasama/0015/0015.py
new file mode 100644
index 00000000..64371333
--- /dev/null
+++ b/sarikasama/0015/0015.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+#from json to xlsx
+
+import xlsxwriter, json
+
+def json2xls():
+ wb = xlsxwriter.Workbook('city.xls')
+ ws = wb.add_worksheet("city")
+
+ with open('./city') as f:
+ data = json.load(f)
+ for i in range(len(data)):
+ ws.write(i, 0, i+1)
+ ws.write(i, 1, data[str(i+1)])
+ wb.close()
+
+if __name__=='__main__':
+ json2xls()
diff --git a/sarikasama/0015/city b/sarikasama/0015/city
new file mode 100644
index 00000000..b5a6874d
--- /dev/null
+++ b/sarikasama/0015/city
@@ -0,0 +1,5 @@
+{
+ "1" : "上海",
+ "2" : "北京",
+ "3" : "成都"
+}
diff --git a/sarikasama/0015/city.xls b/sarikasama/0015/city.xls
new file mode 100644
index 00000000..c4d1e10b
Binary files /dev/null and b/sarikasama/0015/city.xls differ
diff --git a/sarikasama/0016/0016.py b/sarikasama/0016/0016.py
new file mode 100644
index 00000000..269e8997
--- /dev/null
+++ b/sarikasama/0016/0016.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+#from json to xlsx
+
+import xlsxwriter, json
+
+def json2xls():
+ wb = xlsxwriter.Workbook('numbers.xls')
+ ws = wb.add_worksheet("numbers")
+
+ with open('./numbers') as f:
+ data = json.load(f)
+ for i in range(len(data)):
+ for j in range(len(data[i])):
+ ws.write(i, j, data[i][j])
+ wb.close()
+
+if __name__=='__main__':
+ json2xls()
diff --git a/sarikasama/0016/numbers b/sarikasama/0016/numbers
new file mode 100644
index 00000000..dbe6d92f
--- /dev/null
+++ b/sarikasama/0016/numbers
@@ -0,0 +1,5 @@
+[
+ [1, 82, 65535],
+ [20, 90, 13],
+ [26, 809, 1024]
+]
diff --git a/sarikasama/0016/numbers.xls b/sarikasama/0016/numbers.xls
new file mode 100644
index 00000000..e5ea32d8
Binary files /dev/null and b/sarikasama/0016/numbers.xls differ
diff --git a/sarikasama/0017/0017.py b/sarikasama/0017/0017.py
new file mode 100644
index 00000000..d42a7595
--- /dev/null
+++ b/sarikasama/0017/0017.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#convert from xls to xml
+
+import xlrd, json
+from lxml import etree
+from collections import OrderedDict
+
+def xls2xml(xls_name):
+ with xlrd.open_workbook(xls_name) as wb:
+ ws = wb.sheet_by_index(0)
+ table = OrderedDict()
+ for i in range(ws.nrows):
+ key = int(ws.row_values(i)[0])
+ value = str(ws.row_values(i)[1:])
+ table[key] = value
+
+ with open("student.xml", 'w') as f:
+ root = etree.Element("root")
+ e_root = etree.ElementTree(root)
+ e_students = etree.SubElement(root, 'students')
+ e_students.text = '\n'+str(json.dumps(table, indent=4, ensure_ascii=False))+'\n'
+ e_students.append(etree.Comment('\n 学生信息表\n "id" : [名字,数学,语文,英语]\n'))
+ f.write(''+etree.tounicode(e_root.getroot()))
+
+if __name__=="__main__":
+ xls2xml('student.xls')
diff --git a/sarikasama/0017/student.xls b/sarikasama/0017/student.xls
new file mode 100644
index 00000000..8575f90c
Binary files /dev/null and b/sarikasama/0017/student.xls differ
diff --git a/sarikasama/0017/student.xml b/sarikasama/0017/student.xml
new file mode 100644
index 00000000..bb68d95c
--- /dev/null
+++ b/sarikasama/0017/student.xml
@@ -0,0 +1,10 @@
+
+{
+ "1": "['张三', 150.0, 120.0, 100.0]",
+ "2": "['李四', 90.0, 99.0, 95.0]",
+ "3": "['王五', 60.0, 66.0, 68.0]"
+}
+
diff --git a/sarikasama/0018/0018.py b/sarikasama/0018/0018.py
new file mode 100644
index 00000000..277f1ba9
--- /dev/null
+++ b/sarikasama/0018/0018.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+#convert from xls to xml
+
+import xlrd, json
+from lxml import etree
+from collections import OrderedDict
+
+def xls2xml(xls_name):
+ with xlrd.open_workbook(xls_name) as wb:
+ ws = wb.sheet_by_index(0)
+ table = OrderedDict()
+ for i in range(ws.nrows):
+ key = int(ws.row_values(i)[0])
+ value = ws.row_values(i)[1]
+ table[key] = value
+
+ with open("city.xml", 'w') as f:
+ root = etree.Element("root")
+ e_root = etree.ElementTree(root)
+ e_citys = etree.SubElement(root, 'citys')
+ e_citys.text = '\n'+str(json.dumps(table, indent=4, ensure_ascii=False))+'\n'
+ e_citys.append(etree.Comment('\n 城市信息\n'))
+ f.write(''+etree.tounicode(e_root.getroot()))
+
+if __name__=="__main__":
+ xls2xml('city.xls')
diff --git a/sarikasama/0018/city.xls b/sarikasama/0018/city.xls
new file mode 100644
index 00000000..c4d1e10b
Binary files /dev/null and b/sarikasama/0018/city.xls differ
diff --git a/sarikasama/0018/city.xml b/sarikasama/0018/city.xml
new file mode 100644
index 00000000..0db0e9cb
--- /dev/null
+++ b/sarikasama/0018/city.xml
@@ -0,0 +1,9 @@
+
+{
+ "1": "上海",
+ "2": "北京",
+ "3": "成都"
+}
+
diff --git a/sarikasama/0019/0019.py b/sarikasama/0019/0019.py
new file mode 100644
index 00000000..1f10af93
--- /dev/null
+++ b/sarikasama/0019/0019.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+#convert from xls to xml
+
+import xlrd, json
+from lxml import etree
+
+def xls2xml(xls_name):
+ with xlrd.open_workbook(xls_name) as wb:
+ ws = wb.sheet_by_index(0)
+ table = []
+ for i in range(ws.nrows):
+ table.append(ws.row_values(i))
+
+ with open("numbers.xml", 'w') as f:
+ root = etree.Element("root")
+ e_root = etree.ElementTree(root)
+ e_numbers = etree.SubElement(root, 'numbers')
+ e_numbers.text = '\n'+str(json.dumps(table, indent=4))+'\n'
+ e_numbers.append(etree.Comment('\n 数字信息\n'))
+ f.write(''+etree.tounicode(e_root.getroot()))
+
+if __name__=="__main__":
+ xls2xml('numbers.xls')
diff --git a/sarikasama/0019/numbers.xls b/sarikasama/0019/numbers.xls
new file mode 100644
index 00000000..e5ea32d8
Binary files /dev/null and b/sarikasama/0019/numbers.xls differ
diff --git a/sarikasama/0019/numbers.xml b/sarikasama/0019/numbers.xml
new file mode 100644
index 00000000..951bb1d1
--- /dev/null
+++ b/sarikasama/0019/numbers.xml
@@ -0,0 +1,21 @@
+
+[
+ [
+ 1.0,
+ 82.0,
+ 65535.0
+ ],
+ [
+ 20.0,
+ 90.0,
+ 13.0
+ ],
+ [
+ 26.0,
+ 809.0,
+ 1024.0
+ ]
+]
+
diff --git a/sarikasama/0021/0021.py b/sarikasama/0021/0021.py
new file mode 100644
index 00000000..648a830f
--- /dev/null
+++ b/sarikasama/0021/0021.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+
+import hmac, hashlib, os
+
+def encrypt_passwd(password, salt=None):
+ if salt is None:
+ salt = str(os.urandom(8)).encode('utf-8')
+ if isinstance(password, str):
+ password = password.encode('utf-8')
+
+ result = password
+ for i in range(10):
+ result = hmac.HMAC(result, salt, hashlib.sha256).digest()
+ return salt+result
+
+if __name__=="__main__":
+ e_passwd = encrypt_passwd(b'hello')
+ print(e_passwd)
diff --git a/sarikasama/0022/0022.py b/sarikasama/0022/0022.py
new file mode 100644
index 00000000..269a1af9
--- /dev/null
+++ b/sarikasama/0022/0022.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+#change the resolution of pics in dir 'test' to at most 1136*640 for iphone5, 1334*750 for iphone6, or 1920*1080 for iphone6 Plus.
+from PIL import Image
+import os
+
+def main():
+ os.chdir('test')
+ flag = input("Which shen do you use?\n1:iphone5\n2:iphone6\n3:iphone Plus")
+ for root,dirs,files in os.walk(os.getcwd()):
+ for f in files:
+ im = Image.open(f)
+ if flag == 1:
+ if im.size[0] > 1136:
+ im.resize([1136,im.size[1]])
+ if im.size[1] > 640:
+ im.resize([im.size[0],640])
+ elif flag == 2:
+ if im.size[0] > 1334:
+ im.resize([1136,im.size[1]])
+ if im.size[1] > 750:
+ im.resize([im.size[0],750])
+ elif flag == 3:
+ if im.size[0] > 1920:
+ im.resize([1136,im.size[1]])
+ if im.size[1] > 1080:
+ im.resize([im.size[0],1080])
+ else:
+ print("Input fault.")
+ im.save('test_'+im.filename)
+
+if __name__=='__main__':
+ main()
diff --git a/sarikasama/README.md b/sarikasama/README.md
new file mode 100644
index 00000000..3dc0eb68
--- /dev/null
+++ b/sarikasama/README.md
@@ -0,0 +1,2 @@
+# My version of show-me-the-code
+No environment for debuging 0002, 0003 and 0020, so i ignored them
diff --git a/soolx/0000/0000.py b/soolx/0000/0000.py
new file mode 100644
index 00000000..6dee92ec
--- /dev/null
+++ b/soolx/0000/0000.py
@@ -0,0 +1,15 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+from PIL import Image, ImageDraw, ImageFont
+
+def add_text(img, str):
+ im = Image.open(img)
+ tfont = ImageFont.truetype('times.ttf', 20)
+ draw = ImageDraw.Draw(im)
+ width, height = im.size
+ draw.text((width-40,10), str, fill=(0,0,0), font=tfont)
+ im.save(img, 'jpeg')
+
+if __name__ == '__main__':
+ add_text('001.jpg', '911')
diff --git a/soolx/0000/001.jpg b/soolx/0000/001.jpg
new file mode 100644
index 00000000..29d09a3e
Binary files /dev/null and b/soolx/0000/001.jpg differ
diff --git a/soolx/0000/times.ttf b/soolx/0000/times.ttf
new file mode 100644
index 00000000..63b101bc
Binary files /dev/null and b/soolx/0000/times.ttf differ
diff --git a/soolx/0001/0001.py b/soolx/0001/0001.py
new file mode 100644
index 00000000..e69de29b
diff --git a/soolx/README.md b/soolx/README.md
new file mode 100644
index 00000000..01717403
--- /dev/null
+++ b/soolx/README.md
@@ -0,0 +1,201 @@
+## Python 练习册,每天一个小程序 ##
+
+
+#### 说明: ####
+
+- Python 练习册,每天一个小程序。注:将 Python 换成其他语言,大多数题目也适用
+- 不会出现诸如「打印九九乘法表」、「打印水仙花」之类的题目
+- 本文本文由@史江歌(shijiangge@gmail.com QQ:499065469)根据互联网资料收集整理而成,感谢互联网,感谢各位的分享。鸣谢!本文会不断更新。
+- 欢迎大家 Pull Request 出题目,贴代码(Gist、Blog皆可):-)
+- 欢迎解答, 并发送 pull request 到 [Show-Me-the-Code](https://github.com/Show-Me-the-Code/python)
+
+> 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 应用。
+
+- 
+
+**第 0025 题:** 使用 Python 实现:对着电脑吼一声,自动打开浏览器中的默认网站。
+
+
+ 例如,对着笔记本电脑吼一声“百度”,浏览器自动打开百度首页。
+
+ 关键字:Speech to Text
+
+参考思路:
+1:获取电脑录音-->WAV文件
+ python record wav
+
+2:录音文件-->文本
+
+ STT: Speech to Text
+
+ STT API Google API
+
+3:文本-->电脑命令
diff --git a/vvzwvv/0004/0004.py b/vvzwvv/0004/0004.py
new file mode 100644
index 00000000..62e49715
--- /dev/null
+++ b/vvzwvv/0004/0004.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+#-*- coding: utf-8 -*-
+
+import urllib
+import re
+
+def getHtml(url):
+ page = urllib.urlopen(url)
+ html = page.read()
+ return html
+
+def getImg(html):
+ # src="http://imgsrc.baidu.com/forum/w%3D580%3Bcp%3Dtieba%2C10%2C302%3Bap%3D%C9%BC%B1%BE%D3%D0%C3%C0%B0%C9%2C90%2C310/sign=8800a2e3b3119313c743ffb855036fa7/1e29460fd9f9d72abb1a7c3cd52a2834349bbb7e.jpg" bdwater=
+ reg = r'src="(.+?\.jpg)" bdwater='
+ img_re = re.compile(reg)
+ img_list = re.findall(img_re, html)
+ return img_list
+
+def saveImg(img_list):
+ x = 0
+ for img_url in img_list:
+ urllib.urlretrieve(img_url, '%s.jpg' % x)
+ x += 1
+
+
+if __name__ == "__main__":
+ html = getHtml("http://tieba.baidu.com/p/2166231880")
+ saveImg(getImg(html))
\ No newline at end of file
diff --git a/vvzwvv/0010/0010.py b/vvzwvv/0010/0010.py
new file mode 100644
index 00000000..04942a8b
--- /dev/null
+++ b/vvzwvv/0010/0010.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+#-*- coding: utf-8 -*-
+
+import string
+import random
+from PIL import Image, ImageDraw, ImageFont, ImageFilter
+
+def create_image(image_size = (300, 100),
+ background_color = (255, 255, 255),
+ font_type = "arialbd.ttf",
+ font_size = 50,
+ text_num = 4,
+ point_chance = 50):
+
+ im = Image.new("RGB", image_size, background_color)
+ draw = ImageDraw.Draw(im)
+ image_width, image_height = image_size
+
+ def create_text():
+ text_font = ImageFont.truetype(font_type, font_size)
+ font_width, font_height = text_font.getsize("A")
+ for i in range(text_num):
+ text = random.choice(string.ascii_uppercase)
+ text_loc = ((image_width - font_width) / text_num * (i + 0.5), (image_height - font_height) / 2.3)
+ draw.text(text_loc, text, font = text_font, fill = (random.randint(0, 255) / 2, random.randint(0, 255) / 2, random.randint(0, 255) / 2))
+
+ def create_points():
+ for w in range(image_width):
+ for h in range(image_height):
+ tmp = random.randint(0, 100)
+ if tmp > point_chance:
+ draw.point((w, h), fill = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255)))
+
+ create_text()
+ create_points()
+ im = im.filter(ImageFilter.BLUR)
+
+ return im
+
+if __name__ == "__main__":
+ im = create_image()
+ im.show()
diff --git a/vvzwvv/0010/arialbd.ttf b/vvzwvv/0010/arialbd.ttf
new file mode 100644
index 00000000..d5fa0e60
Binary files /dev/null and b/vvzwvv/0010/arialbd.ttf differ
diff --git a/vvzwvv/0011/0011.py b/vvzwvv/0011/0011.py
new file mode 100644
index 00000000..a2398dd7
--- /dev/null
+++ b/vvzwvv/0011/0011.py
@@ -0,0 +1,22 @@
+from cmd import Cmd
+
+class CmdCheck(Cmd):
+
+ def __init__(self):
+ Cmd.__init__(self)
+ self.intro = "-------- Word Sensor (Input \"exit\" for termination) --------"
+ self.prompt = "> "
+ self.sensitive = map(lambda word: word.strip("\n"), open("filtered_words.txt").readlines())
+
+ def default(self, line):
+ if any([word in line for word in self.sensitive]):
+ print "Freedom"
+ else:
+ print "Human Rights"
+
+ def do_exit(self, line):
+ exit()
+
+if __name__ == "__main__":
+ cmd = CmdCheck()
+ cmd.cmdloop()
\ No newline at end of file
diff --git a/vvzwvv/0011/filtered_words.txt b/vvzwvv/0011/filtered_words.txt
new file mode 100644
index 00000000..69373b64
--- /dev/null
+++ b/vvzwvv/0011/filtered_words.txt
@@ -0,0 +1,11 @@
+北京
+程序员
+公务员
+领导
+牛比
+牛逼
+你娘
+你妈
+love
+sex
+jiangge
\ No newline at end of file
diff --git a/vvzwvv/0012/0012.py b/vvzwvv/0012/0012.py
new file mode 100644
index 00000000..1b003829
--- /dev/null
+++ b/vvzwvv/0012/0012.py
@@ -0,0 +1,22 @@
+from cmd import Cmd
+
+class CmdCheck(Cmd):
+
+ def __init__(self):
+ Cmd.__init__(self)
+ self.intro = "-------- Word Sensor (Input \"exit\" for termination) --------"
+ self.prompt = "> "
+ self.sensitive = map(lambda word: word.strip("\n"), open("filtered_words.txt").readlines())
+
+ def default(self, line):
+ for word in self.sensitive:
+ if word in line:
+ line = line.replace(word, ''.join("*" for i in range(len(word))))
+ print line
+
+ def do_exit(self, line):
+ exit()
+
+if __name__ == "__main__":
+ cmd = CmdCheck()
+ cmd.cmdloop()
\ No newline at end of file
diff --git a/vvzwvv/0012/filtered_words.txt b/vvzwvv/0012/filtered_words.txt
new file mode 100644
index 00000000..69373b64
--- /dev/null
+++ b/vvzwvv/0012/filtered_words.txt
@@ -0,0 +1,11 @@
+北京
+程序员
+公务员
+领导
+牛比
+牛逼
+你娘
+你妈
+love
+sex
+jiangge
\ No newline at end of file
diff --git a/will/0000/add_num.py b/will/0000/add_num.py
new file mode 100644
index 00000000..cb116444
--- /dev/null
+++ b/will/0000/add_num.py
@@ -0,0 +1,37 @@
+# 第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果
+'''
+涉及模块/库:
+ 1.Pillow :http://pillow-cn.readthedocs.io/zh_CN/latest/
+ 2.random
+核心方法
+ 1.ImageFont Module:
+ PIL.ImageFont.truetype(font=None, size=10, index=0, encoding='', filename=None)
+ 2.ImageDraw Module:
+ PIL.ImageDraw.Draw.text(xy, text, fill=None, font=None, anchor=None)
+想法思路:
+ 1.Pillow库所读的图片以左上角为原点,类似于第四象限
+ 2.数字添加在图片的右上角,注意控制图片的位置,及xy参数
+'''
+
+
+import random
+from PIL import Image, ImageDraw, ImageFont
+new = 'new.jpg'
+
+def add_num(pic, text):
+ 'add a message number on pics'
+ try:
+ im = Image.open(pic)
+ except:
+ print('failed')
+ width, height = im.size
+ fontsize = height / 4
+ draw = ImageDraw.Draw(im)
+ font = ImageFont.truetype('arial.ttf', int(fontsize))
+ draw.text((0.7*width, 0.02*height), text, font=font, fill='red')
+ im.save(new)
+
+if __name__ == "__main__":
+ number = str(random.randint(1, 99))
+ pic = './old.jpg'
+ add_num(pic, number)
diff --git a/will/0001/app_store.py b/will/0001/app_store.py
new file mode 100644
index 00000000..1ca23d04
--- /dev/null
+++ b/will/0001/app_store.py
@@ -0,0 +1,62 @@
+# 第 0001 题: 做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),使用 Python 如何生成 200 个激活码(或者优惠券)?
+'''
+想法思路:
+ 1. 字符串方式
+ 2. 时间戳方式
+ 3. UUID全局标识符,使用uuid1或者uuid5算法
+ 4. 加密算法
+'''
+
+import random, string, time, math, uuid
+
+chars = string.ascii_letters + string.digits
+
+def gen1():
+ '''
+ 根据26个大小写字母和数字随机选择10个
+ 涉及模块:
+ 1. random:
+ random.random()函数是这个模块中最常用的方法了,它会生成一个随机的浮点数,范围是在0.0~1.0之间。
+ random.uniform()正好弥补了上面函数的不足,它可以设定浮点数的范围,一个是上限,一个是下限。
+ random.randint()随机生一个整数int类型,可以指定这个整数的范围,同样有上限和下限值。
+ random.choice()可以从任何序列,比如list列表中,选取一个随机的元素返回,可以用于字符串、列表、元组等。
+ random.shuffle()如果你想将一个序列中的元素,随机打乱的话可以用这个函数方法。
+ random.sample()可以从指定的序列中,随机的截取指定长度的片断,不作原地修改。
+ 2. string
+ string.digits: 0-9
+ string.printable:可打印字符集
+ string.ascii_letters: 大小字母集
+ '''
+ key = ''.join(random.sample(chars, 10))
+ #key2 = ''.join(random.choice(chars) for i in range(10))
+ return key
+
+def gen2():
+ '''
+ 当前时间戳生成
+ 1. math.modf(x)返回一个list,包括小数部分及整数部分
+ 2. https://gist.github.com/willhunger/85b119793f01211de50db0e0a257dbf0
+ 3. http://www.wklken.me/posts/2015/03/03/python-base-datetime.html
+ '''
+ key = math.modf(time.time())[0]
+ return key
+
+def gen3():
+ '''
+ UUID:通用唯一识别码,由一组32位数的16进制数字所构成
+ uuid1()——基于时间戳
+ 由MAC地址、当前时间戳、随机数生成。可以保证全球范围内的唯一性,但MAC的使用同时带来安全性问题,局域网中可以使用IP来代替MAC。
+ uuid2()——基于分布式计算环境DCE(Python中没有这个函数)
+ 算法与uuid1相同,不同的是把时间戳的前4位置换为POSIX的UID,实际中很少用到该方法。
+ uuid3()——基于名字的MD5散列值
+ 通过计算名字和命名空间的MD5散列值得到,保证了同一命名空间中不同名字的唯一性,和不同命名空间的唯一性,但同一命名空间的同一名字生成相同的uuid。
+ uuid4()——基于随机数
+ 由伪随机数得到,有一定的重复概率,该概率可以计算出来。
+ uuid5()——基于名字的SHA-1散列值
+ 算法与uuid3相同,不同的是使用 Secure Hash Algorithm 1 算法
+
+ '''
+ return uuid.uuid4()
+
+for i in range(200):
+ print(gen2())
diff --git a/will/0002/into_mysql.py b/will/0002/into_mysql.py
new file mode 100644
index 00000000..18f23064
--- /dev/null
+++ b/will/0002/into_mysql.py
@@ -0,0 +1,44 @@
+# 第 0002 题: 将 0001 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中。
+'''
+ 相关模块/库 : pymysql
+ 1. http://www.runoob.com/python3/python3-mysql.html
+'''
+import random, string, time, math, uuid, pymysql
+
+chars = string.ascii_letters + string.digits
+
+def gen1():
+ key = ''.join(random.sample(chars, 10))
+ #key2 = ''.join(random.choice(chars) for i in range(10))
+ return key
+
+def gen2():
+ key = math.modf(time.time())[0]
+ return key
+
+def gen3():
+ return uuid.uuid4()
+
+def dbp():
+ db = pymysql.connect('localhost', 'root', '1213', 'python')
+ cursor = db.cursor()
+ cursor.execute("DROP TABLE IF EXISTS CODE")
+ sql = """CREATE TABLE CODE (
+ app_code CHAR(100) NOT NULL
+ )"""
+ cursor.execute(sql)
+ return db, cursor
+
+if __name__ == '__main__':
+ db, cursor = dbp()
+ for i in range(200):
+ add_code = "INSERT INTO CODE(app_code) VALUES ('%s')" % gen2()
+ # print(add_code)
+ try:
+ cursor.execute(add_code)
+ db.commit()
+ except:
+ db.rollback()
+ db.close()
+ print('finish')
+
diff --git a/will/0003/into_redis.py b/will/0003/into_redis.py
new file mode 100644
index 00000000..362a1aa0
--- /dev/null
+++ b/will/0003/into_redis.py
@@ -0,0 +1,24 @@
+# 第 0003 题: 将 0001 题生成的 200 个激活码(或者优惠券)保存到 Redis 非关系型数据库中。
+import random, string, time, math, uuid, redis
+
+chars = string.ascii_letters + string.digits
+
+def gen1():
+ key = ''.join(random.sample(chars, 10))
+ #key2 = ''.join(random.choice(chars) for i in range(10))
+ return key
+
+def gen2():
+ key = math.modf(time.time())[0]
+ return key
+
+def gen3():
+ return uuid.uuid4()
+
+if __name__ == '__main__':
+ r = redis.Redis(host='localhost', port=6379, db=0)
+ # r.set('name', 'will')
+ # print(r.get('name'))
+ for i in range(200):
+ r.sadd('code', gen1())
+ r.save()
diff --git a/will/0004/sum.py b/will/0004/sum.py
new file mode 100644
index 00000000..6ee85b28
--- /dev/null
+++ b/will/0004/sum.py
@@ -0,0 +1,21 @@
+# 第 0004 题: 任一个英文的纯文本文件,统计其中的单词出现的个数。
+
+import re
+path = './a.txt'
+
+def count(data):
+ words = re.compile('[a-zA-Z0-9]+')
+ di = {}
+ for i in words.findall(data):
+ if i not in di:
+ di[i] = 1
+ else:
+ di[i] += 1
+ return di
+
+if __name__ == '__main__':
+ with open(path, 'r') as file:
+ data = file.read().lower()
+ sumofword = count(data)
+ print(sumofword)
+ file.close()
diff --git a/will/README.md b/will/README.md
new file mode 100644
index 00000000..bfd61ac7
--- /dev/null
+++ b/will/README.md
@@ -0,0 +1,199 @@
+## Python 练习册,每天一个小程序 ##
+
+
+#### 说明: ####
+
+- Python 练习册,每天一个小程序。注:将 Python 换成其他语言,大多数题目也适用
+- 不会出现诸如「打印九九乘法表」、「打印水仙花」之类的题目
+- [点此链接,会看到部分题目的代码,仅供参考](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]
+ }
+
+
+
+
+**第 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 应用。
+
+- 
+
+**第 0025 题:** 使用 Python 实现:对着电脑吼一声,自动打开浏览器中的默认网站。
+
+
+ 例如,对着笔记本电脑吼一声“百度”,浏览器自动打开百度首页。
+
+ 关键字:Speech to Text
+
+参考思路:
+1:获取电脑录音-->WAV文件
+ python record wav
+
+2:录音文件-->文本
+
+ STT: Speech to Text
+
+ STT API Google API
+
+3:文本-->电脑命令
diff --git a/woniuzhang/0001/0001.py b/woniuzhang/0001/0001.py
new file mode 100644
index 00000000..2137a0b5
--- /dev/null
+++ b/woniuzhang/0001/0001.py
@@ -0,0 +1,21 @@
+import random
+import string
+
+words = string.ascii_letters + string.digits
+
+def get_coupon(digit):
+ conpon = ''
+ for i in range(digit):
+ conpon += random.choice(words)
+ return conpon
+
+def two_hundred_coupons():
+# conpons = set()
+ digit = 10
+ for i in range(200):
+ data = '%03d' % i ##数字编码放在最前面,保证验证码唯一性
+ data += get_coupon(digit)
+# conpons.add(data)
+ print(data)
+
+two_hundred_coupons()
diff --git a/woniuzhang/0007/0007.py b/woniuzhang/0007/0007.py
new file mode 100644
index 00000000..1e7466fc
--- /dev/null
+++ b/woniuzhang/0007/0007.py
@@ -0,0 +1,35 @@
+##将空行和注释都放到空行
+
+import re
+
+f = open('readme.md')
+a = f.readlines()
+r1 = re.compile('^"""')
+r3 = re.compile('."""$')
+r2 = re.compile('^#')
+r4 = re.compile('^$')
+kong_count = 0
+daima_count = 0
+flag = 1
+### flag 为标志位,是否遇到"""
+for line in a:
+# print(line)
+ line = line.strip()
+ if flag == 1:
+ if re.match(r1,line):
+ kong_count += 1
+ if re.match(r3,line):
+ pass
+ else:
+ flag = -flag
+ elif re.match(r2,line):
+ kong_count += 1
+ elif line == '':
+ kong_count += 1
+ else:
+ daima_count += 1
+ elif flag == -1:
+ kong_count += 1
+ if re.match(r1,line):
+ flag = -flag
+print('空行 %s, 非空行 %s' %(kong_count, daima_count))
diff --git a/woniuzhang/0007/readme.md b/woniuzhang/0007/readme.md
new file mode 100644
index 00000000..ca4bb9a7
--- /dev/null
+++ b/woniuzhang/0007/readme.md
@@ -0,0 +1,8 @@
+https://github.com/Yixiaohan/show-me-the-code
+"""
+dawde
+dsa
+ """
+
+""" sss"""
+## dad
diff --git a/wssywh/0000/0000.py b/wssywh/0000/0000.py
new file mode 100644
index 00000000..34932429
--- /dev/null
+++ b/wssywh/0000/0000.py
@@ -0,0 +1,18 @@
+#coding:utf-8
+#第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。
+from PIL import Image, ImageDraw, ImageFont
+
+__author__ = 'Hunter'
+
+def picture_num(img,num):
+ im = ImageDraw.Draw(img)
+ print(img.size)
+ numFont = ImageFont.truetype("ahronbd.ttf",300)
+ im.text((260, -50), num, fill=(255, 0, 0),font=numFont)
+ img.save("wechat_100.jpg")
+ img.show()
+
+
+if __name__ == '__main__':
+ img = Image.open("wechat.jpg")
+ picture_num(img,"100")
\ No newline at end of file
diff --git a/wssywh/0000/ahronbd.ttf b/wssywh/0000/ahronbd.ttf
new file mode 100644
index 00000000..a0bd1911
Binary files /dev/null and b/wssywh/0000/ahronbd.ttf differ
diff --git a/wssywh/0000/wechat.jpg b/wssywh/0000/wechat.jpg
new file mode 100644
index 00000000..e1966da9
Binary files /dev/null and b/wssywh/0000/wechat.jpg differ
diff --git a/wssywh/0000/wechat_100.jpg b/wssywh/0000/wechat_100.jpg
new file mode 100644
index 00000000..99a17c13
Binary files /dev/null and b/wssywh/0000/wechat_100.jpg differ
diff --git a/wssywh/0001/0001.py b/wssywh/0001/0001.py
new file mode 100644
index 00000000..0e2ac617
--- /dev/null
+++ b/wssywh/0001/0001.py
@@ -0,0 +1,19 @@
+#coding:utf-8
+
+"""第0001题:做为Apple Store App独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),
+使用Python如何生成200个激活码(或者优惠券)?"""
+
+
+
+import uuid
+
+def get_id(num):
+ list_id = []
+ for i in range(num):
+ id = str(uuid.uuid1()).replace('-','')
+ list_id.append(id)
+ return list_id
+id = get_id(200)
+with open("file_id.txt","w") as file:
+ for i in id:
+ file.write(i+"\n")
\ No newline at end of file
diff --git a/wssywh/0001/file_id b/wssywh/0001/file_id
new file mode 100644
index 00000000..e69de29b
diff --git a/wssywh/0001/file_id.txt b/wssywh/0001/file_id.txt
new file mode 100644
index 00000000..50758132
--- /dev/null
+++ b/wssywh/0001/file_id.txt
@@ -0,0 +1,200 @@
+bac213149c1c11e791d47427ea33ef0a
+bac213159c1c11e791d47427ea33ef0a
+bac213169c1c11e791d47427ea33ef0a
+bac213179c1c11e791d47427ea33ef0a
+bac213189c1c11e791d47427ea33ef0a
+bac213199c1c11e791d47427ea33ef0a
+bac2131a9c1c11e791d47427ea33ef0a
+bac2131b9c1c11e791d47427ea33ef0a
+bac2131c9c1c11e791d47427ea33ef0a
+bac2131d9c1c11e791d47427ea33ef0a
+bac2131e9c1c11e791d47427ea33ef0a
+bac2131f9c1c11e791d47427ea33ef0a
+bac213209c1c11e791d47427ea33ef0a
+bac213219c1c11e791d47427ea33ef0a
+bac213229c1c11e791d47427ea33ef0a
+bac213239c1c11e791d47427ea33ef0a
+bac213249c1c11e791d47427ea33ef0a
+bac213259c1c11e791d47427ea33ef0a
+bac213269c1c11e791d47427ea33ef0a
+bac213279c1c11e791d47427ea33ef0a
+bac213289c1c11e791d47427ea33ef0a
+bac213299c1c11e791d47427ea33ef0a
+bac2132a9c1c11e791d47427ea33ef0a
+bac2132b9c1c11e791d47427ea33ef0a
+bac2132c9c1c11e791d47427ea33ef0a
+bac2132d9c1c11e791d47427ea33ef0a
+bac2132e9c1c11e791d47427ea33ef0a
+bac2132f9c1c11e791d47427ea33ef0a
+bac213309c1c11e791d47427ea33ef0a
+bac213319c1c11e791d47427ea33ef0a
+bac213329c1c11e791d47427ea33ef0a
+bac213339c1c11e791d47427ea33ef0a
+bac213349c1c11e791d47427ea33ef0a
+bac213359c1c11e791d47427ea33ef0a
+bac213369c1c11e791d47427ea33ef0a
+bac213379c1c11e791d47427ea33ef0a
+bac213389c1c11e791d47427ea33ef0a
+bac213399c1c11e791d47427ea33ef0a
+bac2133a9c1c11e791d47427ea33ef0a
+bac2133b9c1c11e791d47427ea33ef0a
+bac2133c9c1c11e791d47427ea33ef0a
+bac2133d9c1c11e791d47427ea33ef0a
+bac2133e9c1c11e791d47427ea33ef0a
+bac2133f9c1c11e791d47427ea33ef0a
+bac213409c1c11e791d47427ea33ef0a
+bac213419c1c11e791d47427ea33ef0a
+bac213429c1c11e791d47427ea33ef0a
+bac213439c1c11e791d47427ea33ef0a
+bac213449c1c11e791d47427ea33ef0a
+bac213459c1c11e791d47427ea33ef0a
+bac213469c1c11e791d47427ea33ef0a
+bac213479c1c11e791d47427ea33ef0a
+bac213489c1c11e791d47427ea33ef0a
+bac213499c1c11e791d47427ea33ef0a
+bac2134a9c1c11e791d47427ea33ef0a
+bac2134b9c1c11e791d47427ea33ef0a
+bac2134c9c1c11e791d47427ea33ef0a
+bac2134d9c1c11e791d47427ea33ef0a
+bac2134e9c1c11e791d47427ea33ef0a
+bac2134f9c1c11e791d47427ea33ef0a
+bac213509c1c11e791d47427ea33ef0a
+bac213519c1c11e791d47427ea33ef0a
+bac213529c1c11e791d47427ea33ef0a
+bac213539c1c11e791d47427ea33ef0a
+bac213549c1c11e791d47427ea33ef0a
+bac213559c1c11e791d47427ea33ef0a
+bac213569c1c11e791d47427ea33ef0a
+bac213579c1c11e791d47427ea33ef0a
+bac213589c1c11e791d47427ea33ef0a
+bac213599c1c11e791d47427ea33ef0a
+bac2135a9c1c11e791d47427ea33ef0a
+bac2135b9c1c11e791d47427ea33ef0a
+bac2135c9c1c11e791d47427ea33ef0a
+bac2135d9c1c11e791d47427ea33ef0a
+bac2135e9c1c11e791d47427ea33ef0a
+bac2135f9c1c11e791d47427ea33ef0a
+bac213609c1c11e791d47427ea33ef0a
+bac213619c1c11e791d47427ea33ef0a
+bac213629c1c11e791d47427ea33ef0a
+bac213639c1c11e791d47427ea33ef0a
+bac213649c1c11e791d47427ea33ef0a
+bac213659c1c11e791d47427ea33ef0a
+bac213669c1c11e791d47427ea33ef0a
+bac213679c1c11e791d47427ea33ef0a
+bac213689c1c11e791d47427ea33ef0a
+bac213699c1c11e791d47427ea33ef0a
+bac2136a9c1c11e791d47427ea33ef0a
+bac2136b9c1c11e791d47427ea33ef0a
+bac2136c9c1c11e791d47427ea33ef0a
+bac2136d9c1c11e791d47427ea33ef0a
+bac2136e9c1c11e791d47427ea33ef0a
+bac2136f9c1c11e791d47427ea33ef0a
+bac213709c1c11e791d47427ea33ef0a
+bac213719c1c11e791d47427ea33ef0a
+bac213729c1c11e791d47427ea33ef0a
+bac213739c1c11e791d47427ea33ef0a
+bac213749c1c11e791d47427ea33ef0a
+bac213759c1c11e791d47427ea33ef0a
+bac213769c1c11e791d47427ea33ef0a
+bac213779c1c11e791d47427ea33ef0a
+bac213789c1c11e791d47427ea33ef0a
+bac213799c1c11e791d47427ea33ef0a
+bac2137a9c1c11e791d47427ea33ef0a
+bac2137b9c1c11e791d47427ea33ef0a
+bac2137c9c1c11e791d47427ea33ef0a
+bac2137d9c1c11e791d47427ea33ef0a
+bac2137e9c1c11e791d47427ea33ef0a
+bac2137f9c1c11e791d47427ea33ef0a
+bac213809c1c11e791d47427ea33ef0a
+bac213819c1c11e791d47427ea33ef0a
+bac213829c1c11e791d47427ea33ef0a
+bac213839c1c11e791d47427ea33ef0a
+bac213849c1c11e791d47427ea33ef0a
+bac213859c1c11e791d47427ea33ef0a
+bac213869c1c11e791d47427ea33ef0a
+bac213879c1c11e791d47427ea33ef0a
+bac213889c1c11e791d47427ea33ef0a
+bac213899c1c11e791d47427ea33ef0a
+bac2138a9c1c11e791d47427ea33ef0a
+bac2138b9c1c11e791d47427ea33ef0a
+bac2138c9c1c11e791d47427ea33ef0a
+bac2138d9c1c11e791d47427ea33ef0a
+bac2138e9c1c11e791d47427ea33ef0a
+bac2138f9c1c11e791d47427ea33ef0a
+bac213909c1c11e791d47427ea33ef0a
+bac213919c1c11e791d47427ea33ef0a
+bac213929c1c11e791d47427ea33ef0a
+bac213939c1c11e791d47427ea33ef0a
+bac213949c1c11e791d47427ea33ef0a
+bac213959c1c11e791d47427ea33ef0a
+bac213969c1c11e791d47427ea33ef0a
+bac213979c1c11e791d47427ea33ef0a
+bac213989c1c11e791d47427ea33ef0a
+bac213999c1c11e791d47427ea33ef0a
+bac2139a9c1c11e791d47427ea33ef0a
+bac2139b9c1c11e791d47427ea33ef0a
+bac2139c9c1c11e791d47427ea33ef0a
+bac2139d9c1c11e791d47427ea33ef0a
+bac2139e9c1c11e791d47427ea33ef0a
+bac2139f9c1c11e791d47427ea33ef0a
+bac213a09c1c11e791d47427ea33ef0a
+bac213a19c1c11e791d47427ea33ef0a
+bac213a29c1c11e791d47427ea33ef0a
+bac213a39c1c11e791d47427ea33ef0a
+bac213a49c1c11e791d47427ea33ef0a
+bac213a59c1c11e791d47427ea33ef0a
+bac213a69c1c11e791d47427ea33ef0a
+bac213a79c1c11e791d47427ea33ef0a
+bac213a89c1c11e791d47427ea33ef0a
+bac213a99c1c11e791d47427ea33ef0a
+bac213aa9c1c11e791d47427ea33ef0a
+bac213ab9c1c11e791d47427ea33ef0a
+bac213ac9c1c11e791d47427ea33ef0a
+bac213ad9c1c11e791d47427ea33ef0a
+bac213ae9c1c11e791d47427ea33ef0a
+bac213af9c1c11e791d47427ea33ef0a
+bac213b09c1c11e791d47427ea33ef0a
+bac213b19c1c11e791d47427ea33ef0a
+bac213b29c1c11e791d47427ea33ef0a
+bac213b39c1c11e791d47427ea33ef0a
+bac213b49c1c11e791d47427ea33ef0a
+bac213b59c1c11e791d47427ea33ef0a
+bac213b69c1c11e791d47427ea33ef0a
+bac213b79c1c11e791d47427ea33ef0a
+bac213b89c1c11e791d47427ea33ef0a
+bac213b99c1c11e791d47427ea33ef0a
+bac213ba9c1c11e791d47427ea33ef0a
+bac213bb9c1c11e791d47427ea33ef0a
+bac213bc9c1c11e791d47427ea33ef0a
+bac213bd9c1c11e791d47427ea33ef0a
+bac213be9c1c11e791d47427ea33ef0a
+bac213bf9c1c11e791d47427ea33ef0a
+bac213c09c1c11e791d47427ea33ef0a
+bac213c19c1c11e791d47427ea33ef0a
+bac213c29c1c11e791d47427ea33ef0a
+bac213c39c1c11e791d47427ea33ef0a
+bac213c49c1c11e791d47427ea33ef0a
+bac213c59c1c11e791d47427ea33ef0a
+bac213c69c1c11e791d47427ea33ef0a
+bac213c79c1c11e791d47427ea33ef0a
+bac213c89c1c11e791d47427ea33ef0a
+bac213c99c1c11e791d47427ea33ef0a
+bac213ca9c1c11e791d47427ea33ef0a
+bac213cb9c1c11e791d47427ea33ef0a
+bac213cc9c1c11e791d47427ea33ef0a
+bac213cd9c1c11e791d47427ea33ef0a
+bac213ce9c1c11e791d47427ea33ef0a
+bac213cf9c1c11e791d47427ea33ef0a
+bac213d09c1c11e791d47427ea33ef0a
+bac213d19c1c11e791d47427ea33ef0a
+bac213d29c1c11e791d47427ea33ef0a
+bac213d39c1c11e791d47427ea33ef0a
+bac213d49c1c11e791d47427ea33ef0a
+bac213d59c1c11e791d47427ea33ef0a
+bac213d69c1c11e791d47427ea33ef0a
+bac213d79c1c11e791d47427ea33ef0a
+bac213d89c1c11e791d47427ea33ef0a
+bac213d99c1c11e791d47427ea33ef0a
+bac213da9c1c11e791d47427ea33ef0a
+bac213db9c1c11e791d47427ea33ef0a
diff --git a/wssywh/0002/0002.py b/wssywh/0002/0002.py
new file mode 100644
index 00000000..11fa3167
--- /dev/null
+++ b/wssywh/0002/0002.py
@@ -0,0 +1,24 @@
+#coding:utf-8
+"""第 0002 题:将 0001 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中。"""
+
+import MySQLdb
+
+list_id = []
+with open("../0001/file_id.txt",'r') as file:
+ files = file.readlines()
+ for content in files:
+ list_id.append(str(content).replace('\n',''))
+try:
+ conn = MySQLdb.connect(host='localhost',user='root',passwd='123456',port=3306)
+ cur = conn.cursor()
+ cur.execute('create database if not exists test')
+ conn.select_db('test')
+ cur.execute('create table if not exists Activation_code(id int ,uuid varchar(50))')
+ for i in range(len(list_id)):
+ cur.execute('insert into Activation_code values(%s,%s)',(i,list_id[i]))
+ conn.commit()
+ cur.close()
+ conn.close()
+except MySQLdb.Error as e:
+ print("Mysql Error %d: %s" % (e.args[0], e.args[1]))
+
diff --git a/xyjxyf/0000/0000.jpg b/xyjxyf/0000/0000.jpg
new file mode 100644
index 00000000..1f4d8579
Binary files /dev/null and b/xyjxyf/0000/0000.jpg differ
diff --git a/xyjxyf/0004/0004.txt b/xyjxyf/0004/0004.txt
new file mode 100644
index 00000000..cf950a09
--- /dev/null
+++ b/xyjxyf/0004/0004.txt
@@ -0,0 +1,4 @@
+
+Henry was a pen name used by an American writer of short stories.
+
+His real name was William Sydney Porter.
diff --git a/xyjxyf/0005/1.jpg b/xyjxyf/0005/1.jpg
new file mode 100644
index 00000000..1f4d8579
Binary files /dev/null and b/xyjxyf/0005/1.jpg differ
diff --git a/xyjxyf/0005/2.jpg b/xyjxyf/0005/2.jpg
new file mode 100644
index 00000000..177dfc8e
Binary files /dev/null and b/xyjxyf/0005/2.jpg differ
diff --git a/xyjxyf/0006/00061.txt b/xyjxyf/0006/00061.txt
new file mode 100644
index 00000000..48ba0476
--- /dev/null
+++ b/xyjxyf/0006/00061.txt
@@ -0,0 +1,12 @@
+
+Henry was a pen name used by an American writer of short stories.
+
+His
+
+His
+
+His
+
+His
+
+Henry was a pen name used by an American writer of short stories.
diff --git a/xyjxyf/0006/00062.txt b/xyjxyf/0006/00062.txt
new file mode 100644
index 00000000..af894a51
--- /dev/null
+++ b/xyjxyf/0006/00062.txt
@@ -0,0 +1,7 @@
+
+Henry was a pen name used by an American writer of short stories.
+
+His real name was William Sydney Porter.
+
+pen pen
+pen pen pen pen pen pen
diff --git a/xyjxyf/0007/stringer.py b/xyjxyf/0007/stringer.py
new file mode 100644
index 00000000..56d9d3b3
--- /dev/null
+++ b/xyjxyf/0007/stringer.py
@@ -0,0 +1,29 @@
+# coding = utf-8
+
+import random, string
+
+/*
+sdfhjdsf
+hgjh
+*/
+# def Unicode():
+# val = random.randint(0x4E00, 0x9FBF)
+# return unichr(val)
+#
+# # 随机汉字
+# def GB2312():
+# head = random.randint(0xB0, 0xCF)
+# body = random.randint(0xA, 0xF)
+# tail = random.randint(0, 0xF)
+# val = ( head << 8 ) | (body << 4) | tail
+# str = "%x" % val
+# return str.decode('hex').decode('gb2312')
+
+# 随机字母
+def rand_char():
+ return chr(random.randint(65, 90))
+
+# 随机字母或者数字
+def rand_choice():
+ str = 'abcdefghigklmnopqrstuvwxyzQWERTYUIOPASDFGHJKLZXCVBNM1234567890'
+ return random.choice(str)
diff --git a/xyjxyf/0011/0011.txt b/xyjxyf/0011/0011.txt
new file mode 100644
index 00000000..693f4665
--- /dev/null
+++ b/xyjxyf/0011/0011.txt
@@ -0,0 +1,11 @@
+北京
+程序员
+公务员
+领导
+牛比
+牛逼
+你娘
+你妈
+love
+sex
+jiangge
diff --git a/xyjxyf/0014/student.txt b/xyjxyf/0014/student.txt
new file mode 100644
index 00000000..ea9b1593
--- /dev/null
+++ b/xyjxyf/0014/student.txt
@@ -0,0 +1,5 @@
+{
+ "1":["张三",150,120,100],
+ "2":["李四",90,99,95],
+ "3":["王五",60,66,68]
+}
\ No newline at end of file
diff --git a/xyjxyf/0014/student.xls b/xyjxyf/0014/student.xls
new file mode 100644
index 00000000..b80d5719
Binary files /dev/null and b/xyjxyf/0014/student.xls differ
diff --git a/xyjxyf/0015/city.txt b/xyjxyf/0015/city.txt
new file mode 100644
index 00000000..312f5c19
--- /dev/null
+++ b/xyjxyf/0015/city.txt
@@ -0,0 +1,5 @@
+{
+ "1" : "上海",
+ "2" : "北京",
+ "3" : "成都"
+}
\ No newline at end of file
diff --git a/xyjxyf/0015/city.xls b/xyjxyf/0015/city.xls
new file mode 100644
index 00000000..b020435b
Binary files /dev/null and b/xyjxyf/0015/city.xls differ
diff --git a/xyjxyf/0016/numbers.txt b/xyjxyf/0016/numbers.txt
new file mode 100644
index 00000000..c43c0378
--- /dev/null
+++ b/xyjxyf/0016/numbers.txt
@@ -0,0 +1,5 @@
+[
+ [1, 82, 65535],
+ [20, 90, 13],
+ [26, 809, 1024]
+]
\ No newline at end of file
diff --git a/xyjxyf/0016/numbers.xls b/xyjxyf/0016/numbers.xls
new file mode 100644
index 00000000..091d6ef7
Binary files /dev/null and b/xyjxyf/0016/numbers.xls differ
diff --git a/xyjxyf/0017/student.xls b/xyjxyf/0017/student.xls
new file mode 100644
index 00000000..b80d5719
Binary files /dev/null and b/xyjxyf/0017/student.xls differ
diff --git a/xyjxyf/0017/student.xml b/xyjxyf/0017/student.xml
new file mode 100644
index 00000000..55abaffe
--- /dev/null
+++ b/xyjxyf/0017/student.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ {
+ 3: ['王五', 60.0, 66.0, 68.0]
+ 2: ['李四', 90.0, 99.0, 95.0]
+ 1: ['张三', 150.0, 120.0, 100.0]
+ }
+
+
diff --git a/xyjxyf/0018/city.xls b/xyjxyf/0018/city.xls
new file mode 100644
index 00000000..b020435b
Binary files /dev/null and b/xyjxyf/0018/city.xls differ
diff --git a/xyjxyf/0018/city.xml b/xyjxyf/0018/city.xml
new file mode 100644
index 00000000..00af5e13
--- /dev/null
+++ b/xyjxyf/0018/city.xml
@@ -0,0 +1,13 @@
+
+
+
+ {
+ 3: ['成都']
+ 2: ['北京']
+ 1: ['上海']
+ }
+
+
+
diff --git a/xyjxyf/0019/numbers.xls b/xyjxyf/0019/numbers.xls
new file mode 100644
index 00000000..091d6ef7
Binary files /dev/null and b/xyjxyf/0019/numbers.xls differ
diff --git a/xyjxyf/0019/numbers.xml b/xyjxyf/0019/numbers.xml
new file mode 100644
index 00000000..8a6fcfd0
--- /dev/null
+++ b/xyjxyf/0019/numbers.xml
@@ -0,0 +1,13 @@
+
+
+
+ [
+ [1.0, 82.0, 65535.0],
+ [20.0, 90.0, 13.0],
+ [26.0, 809.0, 1024.0],
+ ]
+
+
+
diff --git a/xyjxyf/0020/0020.xls b/xyjxyf/0020/0020.xls
new file mode 100644
index 00000000..f0d493e5
Binary files /dev/null and b/xyjxyf/0020/0020.xls differ
diff --git a/xyjxyf/0025/voice_open_browser.py b/xyjxyf/0025/voice_open_browser.py
new file mode 100644
index 00000000..f4127c29
--- /dev/null
+++ b/xyjxyf/0025/voice_open_browser.py
@@ -0,0 +1,78 @@
+# encoding = utf-8
+
+# use pyAudio
+# brew install portaudio
+# pip install pyaudio
+
+import wave, pyaudio
+from datetime import datetime
+from tools import dxbaiduaudio
+import webbrowser
+
+CHUNK = 1024
+FORMAT = pyaudio.paInt16
+RATE = 8000
+CHANNELS = 1
+RECORD_SECONDS = 5
+
+def record_wave(to_dir=None):
+ if to_dir is None:
+ to_dir = "./"
+
+ pa = pyaudio.PyAudio()
+ stream = pa.open(format = FORMAT,
+ channels = CHANNELS,
+ rate = RATE,
+ input = True,
+ frames_per_buffer = CHUNK)
+
+ print("* recording")
+
+ save_buffer = []
+ for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
+ audio_data = stream.read(CHUNK)
+ save_buffer.append(audio_data)
+
+ print("* done recording")
+
+ # stop
+ stream.stop_stream()
+ stream.close()
+ pa.terminate()
+
+ # wav path
+ file_name = datetime.now().strftime("%Y-%m-%d_%H_%M_%S")+".wav"
+ if to_dir.endswith('/'):
+ file_path = to_dir + file_name
+ else:
+ file_path = to_dir + "/" + file_name
+
+ # save file
+ wf = wave.open(file_path, 'wb')
+ wf.setnchannels(CHANNELS)
+ wf.setsampwidth(pa.get_sample_size(FORMAT))
+ wf.setframerate(RATE)
+ # join 前的类型
+ wf.writeframes(b''.join(save_buffer))
+ wf.close()
+
+ return file_path
+
+def browser_open_text(text):
+ if text is None:
+ return
+
+ url = "http://www.baidu.com"
+ if text.startswith("谷歌") or text.startswith("google"):
+ url = "http://www.google.com"
+ elif text.startswith("必应") or text.startswith("bing"):
+ url = "http://cn.bing.com"
+
+ webbrowser.open_new_tab(url)
+
+if __name__ == "__main__":
+ to_dir = "./"
+ file_path = record_wave(to_dir)
+
+ text = dxbaiduaudio.wav_to_text(file_path)
+ browser_open_text(text)
diff --git a/xyjxyf/README.md b/xyjxyf/README.md
new file mode 100644
index 00000000..f579e43b
--- /dev/null
+++ b/xyjxyf/README.md
@@ -0,0 +1,55 @@
+xyjxyf Notes
+======
+## Mac上安装Redis
+
+1. 下载源文件
+
+[redis-3.0.7.rar.gz](http://download.redis.io/releases/)
+
+2. 安装
+
+```
+$ tar -zxvf redis-3.0.6.tar.gz
+$ cd redis-3.0.7
+$ make test
+$ make install
+```
+
+3. 配置
+
+```
+$ vi ./redis.conf
+
+ # 设置为后台运行
+daemonize yes
+
+ # 设置pid文件位置
+pidfile /usr/local/redis/redis.pid
+
+ # 连接超时时间设置为120秒
+timeout 120
+
+ # 设置日志级别
+loglevel debug
+
+ # 设置日志文件位置
+logfile "/usr/local/redis/log/6379.log"
+
+ # 数据文件所在目录
+dir /usr/local/redis/data/6379
+```
+
+4. 启动redis服务器
+
+```
+$ ./redis-server
+```
+
+5. 安装Python的Redis模块
+
+我的mac安装了python双版本,用python3
+
+
+```
+$ pip3 install redis
+```
\ No newline at end of file
diff --git a/xyjxyf/show_me_the_code.py b/xyjxyf/show_me_the_code.py
new file mode 100644
index 00000000..ff3a36d1
--- /dev/null
+++ b/xyjxyf/show_me_the_code.py
@@ -0,0 +1,622 @@
+# coding = utf-8
+
+from tools import imager
+from PIL import ImageFont
+
+
+# 第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字
+def add_num(image_path):
+ im = imager.open_image(image_path)
+ if im is not None:
+ font = ImageFont.truetype('Arial.ttf', 20)
+ w, h = im.size
+ point = (w - 10, 0)
+ imager.draw_text(im, "8", point, font)
+ im.show()
+
+
+# 第 0001 题:使用 Python 生成 200 个激活码(或者优惠券)
+import uuid
+
+def create_activation_code(num=200):
+ codes = []
+ for i in range(num):
+ code = str(uuid.uuid1())
+ code = code.replace('-', '')
+ codes.append(code)
+
+ return codes
+
+
+# 第 0002 题:将 0001 题生成的 200 个激活码(或者优惠券)保存到 MySQL 关系型数据库中。
+import pymysql
+
+def save_activation_code_to_mysql():
+ conn = pymysql.connect(host='localhost', user='root', charset='UTF8')
+ cur = conn.cursor()
+ cur.execute("CREATE DATABASE IF NOT EXISTS code_mysql")
+ cur.execute("USE code_mysql")
+ cur.execute("CREATE TABLE IF NOT EXISTS codes (id INT, code VARCHAR(255))")
+
+ codes = create_activation_code(200)
+ for code in codes:
+ cur.execute("INSERT INTO codes (code) values(%s)", [code])
+
+ conn.commit()
+
+ cur.execute("SELETE * FROM codes")
+ data = cur.fetchall()
+ print("data:%s" % data)
+
+ cur.close()
+ conn.close()
+
+
+# 第 0003 题:将 0001 题生成的 200 个激活码(或者优惠券)保存到 Redis 非关系型数据库中。
+import redis
+
+def save_activation_code_to_redis():
+ re = redis.Redis(host='127.0.0.1', port=6379, db=0)
+
+ codes = create_activation_code(200)
+ for code in codes:
+ re.lpop('codes', code)
+
+ print("data:%s" % re.get('codes'))
+
+
+# 第 0004 题:任一个英文的纯文本文件,统计其中的单词出现的个数。
+import re
+
+def number_of_words(file_path=None):
+ num = 0
+
+ if file_path is None:
+ return num
+
+ file = open(file_path, 'r')
+ content = file.read()
+ content = " " + content
+ pattern = re.compile(u'\s+\w+')
+ match = pattern.findall(content)
+ num = len(match)
+
+ return num
+
+
+# 第 0005 题:你有一个目录,装了很多照片,把它们的尺寸变成都不大于 iPhone5 分辨率的大小。
+def reset_images_size(dir_path=None):
+ if dir_path is None:
+ return
+
+ for root, dirs, files in os.walk(dir_path):
+ for path in files:
+ if path.startswith("."):
+ continue
+
+ file_path = os.path.join(root, path)
+ image = imager.open_image(file_path)
+ if image is not None:
+ new_image = imager.reset_image_size(image, 640, 1136)
+ imager.save(new_image, file_path)
+
+
+# 第 0006 题:你有一个目录,放了你一个月的日记,都是 txt,
+# 为了避免分词的问题,假设内容都是英文,请统计出你认为每篇日记最重要的词。
+# 思路:哪个词出现的最多,哪个词就是最重要的词
+import operator
+
+def get_most_important_word(dir_path=None):
+ if dir_path is None:
+ return None
+
+ for root, dirs, files in os.walk(dir_path):
+ for path in files:
+ if not path.endswith("txt"):
+ continue
+
+ file_path = os.path.join(root, path)
+ content = open(file_path, 'r').read().lower()
+
+ words = content.split()
+ word_dic = {}
+ for word in words:
+ if word in word_dic.keys():
+ word_dic[word] += 1
+ else:
+ word_dic[word] = 1
+
+ if len(word_dic):
+ word_list = sorted(word_dic.items(), key=lambda x:x[1], reverse=True)
+ print("%s : %s -- %d" % (path, word_list[0][0], word_list[0][1]))
+
+
+
+# 第 0007 题:有个目录,里面是你自己写过的程序,统计一下你写过多少行代码。包括空行和注释,但是要分别列出来
+import os
+
+# 注释://, #, /* */, """ """, ''' '''
+def lines_of_codes(dir_path=None):
+ code_num = 0
+ note_num = 0
+ blank_line_num = 0
+ if dir_path is None:
+ return code_num, note_num, blank_line_num
+
+ for root, dirs, files in os.walk(dir_path):
+ mut_note = None
+ for path in files:
+ if path.startswith("."):
+ continue
+
+ file_path = os.path.join(root, path)
+ for count, line in enumerate(open(file_path, "rU")):
+
+ # 判断是否是空行
+ if not line.split():
+ blank_line_num += 1
+ continue
+
+ # 判断是否多行注释
+ if mut_note is not None:
+ note_num += 1
+ match_note = re.match("\*/|\"\"\"|\'\'\'", line)
+ if match_note is not None:
+ mut_note = None
+ match_note = re.match("\/\*|\"\"\"|\'\'\'", line)
+ if match_note is not None:
+ mut_note = line[match_note.pos:(match_note.endpos - 1)]
+
+ continue
+ else:
+ match_note = re.match("\/\*|\"\"\"|\'\'\'", line)
+ if match_note is not None:
+ note_num += 1
+ mut_note = line[match_note.pos:(match_note.endpos - 1)]
+ continue
+
+ # 判断单行注释
+ match_note1 = re.match("\s*(#|//).*\n*", line)
+ if match_note1 is not None:
+ note_num += 1
+ continue
+
+ pass
+
+ code_num += count + 1
+
+ return code_num, note_num, blank_line_num
+
+# 第 0008 题:一个HTML文件,找出里面的正文
+# 使用 pip install beautifulsoup4
+from bs4 import BeautifulSoup
+
+def get_html_context(url=None):
+ if url is None:
+ return None
+
+ content = request.urlopen(url).read().decode("utf-8")
+ soup = BeautifulSoup(content)
+ [script.extract() for script in soup.find_all('script')]
+ [style.extract() for style in soup.find_all('style')]
+
+ soup.prettify()
+ reg = re.compile("<[^>]*>")
+ ret_content = reg.sub('', soup.prettify())
+ # print(ret_content)
+
+ return ret_content
+
+
+# 第 0009 题:一个HTML文件,找出里面的链接
+# 查找, 用 HTMLParser
+from urllib import request
+from tools import dxhtmlparser
+
+def get_html_links(url=None):
+ if url is None:
+ return None
+
+ content = request.urlopen(url).read().decode("utf-8")
+ dxparser = dxhtmlparser.DXHTMLParser('a', 'href', url)
+ dxparser.feed(content)
+
+ links = dxparser.getrets()
+
+ return links
+
+# 第 0010 题:使用 Python 生成字母验证码图片
+def create_verification_code():
+ im, str = imager.verification_code()
+ im.show()
+
+
+# 第 0011 题: 敏感词文本文件 filtered_words.txt,里面的内容为以下内容,
+# 北京, 程序员, 公务员, 领导, 牛比, 牛逼, 你娘, 你妈, love, sex, jiangge
+# 当用户输入敏感词语时,则打印出 Freedom,否则打印出 Human Rights。
+
+def find_sensitive_words(sensitive_file=None, input_string=None):
+ if sensitive_file is None or input_string is None:
+ return None
+
+ file = open(sensitive_file, "r")
+ sensitive_words = file.read().split()
+
+ is_sensitive = False
+ for sensitive in sensitive_words:
+ if sensitive in input_string:
+ is_sensitive = True
+ print("Freedom")
+
+ if not is_sensitive:
+ print("Human Rights")
+
+
+# 第 0012 题: 敏感词文本文件 filtered_words.txt,里面的内容 和 0011题一样,
+# 当用户输入敏感词语,则用 星号 * 替换,例如当用户输入「北京是个好城市」,则变成「**是个好城市」。
+
+def replace_sensitive_words(sensitive_file=None, input_string=None):
+ if sensitive_file is None or input_string is None:
+ return None
+
+ file = open(sensitive_file, "r")
+ sensitive_words = file.read().split()
+
+ for sensitive in sensitive_words:
+ if sensitive in input_string:
+ replace_str = "*" * len(sensitive)
+ input_string = input_string.replace(sensitive, replace_str)
+
+ print(input_string)
+
+# 第 0013 题: 用 Python 写一个爬图片的程序
+from tools import geturlimgs
+
+def get_url_imgs(url=None):
+ if url is None:
+ return None
+
+ tmp = geturlimgs.geturlimgs()
+ tmp.get_imgs(url, "/Users/xieyajie/Desktop/Python/ShowMeCode/xyjxyf/0013/")
+
+
+
+# 第 0014 题: 纯文本文件 student.txt为学生信息, 写到 student.xls 文件中
+# 第 0015 题: 纯文本文件 city.txt为城市信息,写到 city.xls 文件中
+import json
+import xlwt
+
+def dictxt_to_xls(file_path=None):
+ if file_path is None:
+ return
+
+ file = open(file_path, 'r')
+ if file is None:
+ return
+
+ content = json.loads(file.read())
+ list_data = sorted(content.items(), key=lambda d:d[0])
+
+ (path, name)=os.path.split(file.name)
+ file_name = name.split('.')[0]
+
+ wb = xlwt.Workbook()
+ ws = wb.add_sheet(file_name)
+
+ row = 0
+ for item in list_data:
+ col = 0
+ ws.write(row, col, item[0])
+ col += 1
+
+ value = item[1]
+ if type(value) == list:
+ for obj in value:
+ ws.write(row, col, obj)
+ col += 1
+ else:
+ ws.write(row, col, value)
+ row += 1
+
+ save_path = path + "/" + file_name + ".xls"
+ wb.save(save_path)
+
+
+# 第 0016 题: 纯文本文件 numbers.txt, 请将上述内容写到 numbers.xls 文件中
+def listtxt_to_xls(file_path=None):
+ if file_path is None:
+ return
+
+ file = open(file_path)
+ if file is None:
+ return
+
+ content = json.loads(file.read())
+ content.sort(key=lambda x:x[0])
+
+ (path, name)=os.path.split(file.name)
+ file_name = name.split('.')[0]
+ wb = xlwt.Workbook()
+ ws = wb.add_sheet(file_name)
+
+ for i in range(len(content)):
+ col = 0
+ list = content[i]
+ for value in list:
+ ws.write(i, col, content[i][col])
+ col += 1
+
+ save_path = path + "/" + file_name + ".xls"
+ wb.save(save_path)
+
+# pip3 install xlrd
+import xlrd
+def read_xls(file_path=None):
+ if file_path is None:
+ return None
+
+ data_list = {}
+ wb = xlrd.open_workbook(file_path)
+ sheet_names = wb.sheet_names()
+ for name in sheet_names:
+ table = wb.sheet_by_name(name)
+ table_data = []
+ for i in range(table.nrows):
+ row_data = table.row_values(i)
+ table_data.append(row_data)
+
+ data_list[name] = table_data
+
+ return data_list
+
+
+# 第 0017 题: 将 第 0014 题中的 student.xls 文件中的内容写到 student.xml 文件中
+# 使用DOM
+from tools import stringer
+from xml.dom.minidom import Document
+
+def write_student_to_xml(dic=None, to_path=None):
+ if dic is None or to_path is None:
+ return None
+
+ doc = Document()
+ root_node = doc.createElement("root")
+ doc.appendChild(root_node)
+
+ stu_node = doc.createElement("students")
+ root_node.appendChild(stu_node)
+
+ note_node = doc.createComment("\n\t学生信息表\n\t\"id\" : [名字, 数学, 语文, 英文]\n\t")
+ stu_node.appendChild(note_node)
+
+ # data = json.dumps(dic, ensure_ascii=False, indent=1)
+ dic_node = doc.createTextNode(stringer.dict_to_json(dic, "\t\t"))
+ stu_node.appendChild(dic_node)
+
+ file = open(to_path, "w")
+ file.write(doc.toprettyxml())
+ # doc.writexml(file,' ',' ','\n','utf-8')
+ file.close()
+
+# 第 0018 题: 将 第 0015 题中的 city.xls 文件中的内容写到 city.xml 文件中
+# 使用lxml
+import codecs
+from lxml import etree
+
+def write_city_to_xml(dic=None, to_path=None):
+ if dic is None or to_path is None:
+ return None
+
+ root_node = etree.Element('root')
+ root_node.text = "\n\t"
+
+ city_node = etree.SubElement(root_node, 'citys')
+
+ comment_node = etree.Comment("\n城市信息\n")
+ comment_node.tail = "\n\t"
+ city_node.append(comment_node)
+
+ city_node.text = "\n\t" + stringer.dict_to_json(dic, "\t") + u'\n'
+ city_node.tail = "\n"
+
+ city_tree = etree.ElementTree(root_node)
+ city_tree.write(to_path, pretty_print=True, xml_declaration=True, encoding='utf-8')
+ # output = codecs.open(to_path, 'w', 'utf-8')
+ # output.write(etree.tounicode(city_tree.getroot()))
+ # output.close()
+
+
+# 第 0019 题: 将 第 0016 题中的 numbers.xls 文件中的内容写到 numbers.xml 文件中
+def write_numbers_to_xml(list=None, to_path=None):
+ if list is None or to_path is None:
+ return None
+
+ root_node = etree.Element('root')
+ root_node.text = "\n\t"
+
+ number_node = etree.SubElement(root_node, 'numbers')
+
+ comment_node = etree.Comment("\n数字信息\n")
+ comment_node.tail = "\n\t"
+ number_node.append(comment_node)
+
+ number_node.text = "\n\t" + stringer.list_to_json(list, "\t") + u'\n'
+ number_node.tail = "\n"
+
+ number_tree = etree.ElementTree(root_node)
+ number_tree.write(to_path, pretty_print=True, xml_declaration=True, encoding='utf-8')
+
+
+# 第 0020 题: 登陆中国联通网上营业厅 后选择「自助服务」 --> 「详单查询」,然后选择你要查询的时间段,点击「查询」按钮,
+# 查询结果页面的最下方,点击「导出」,就会生成类似于 2014年10月01日~2014年10月31日通话详单.xls 文件。
+# 写代码,对每月通话时间做个统计
+
+import datetime
+
+def statistics_month_time():
+ dic = {}
+ wb = xlrd.open_workbook("./0020/0020.xls")
+ sheet = wb.sheets()[0]
+ row_count = sheet.nrows
+
+ for i in range(1, sheet.nrows):
+ values = sheet.row_values(i)
+ ym_str = values[2][:6]
+
+ time_str = values[3]
+ if '时' in time_str:
+ time_str = re.sub('时', '.', time_str)
+ if '分' in time_str:
+ time_str = re.sub('分', '.', time_str)
+ if '秒' in time_str:
+ time_str = re.sub('秒', '', time_str)
+
+ tmp = time_str.split('.')
+ j = len(tmp) - 1
+ sum = int(tmp[j])
+ while j > -1:
+ sum = sum + (len(tmp) - 1 - j) * 60 * int(tmp[j])
+ j = j - 1
+
+ if ym_str in dic:
+ dic[ym_str] = dic[ym_str] + int(sum)
+ else:
+ dic[ym_str] = int(sum)
+
+ # i = i + 1
+
+ return dic
+
+
+# 第 0021 题: 请使用 Python 对密码加密
+from hashlib import sha256
+from hmac import HMAC
+
+def encrypt_password(password, salt=None):
+ if salt is None:
+ salt = os.urandom(8)
+
+ if isinstance(password, str):
+ password = password.encode('UTF-8')
+
+ ret = password
+ for i in range(10):
+ ret = HMAC(ret, salt, sha256).digest()
+
+ return salt + ret
+
+
+# 第 0022 题: iPhone 6、iPhone 6 Plus 早已上市开卖。请查看你写得 第 0005 题的代码是否可以复用
+
+
+# 第 0023 题: 使用 Python 的 Web 框架,做一个 Web 版本 留言簿 应用
+
+
+# 第 0024 题: 使用 Python 的 Web 框架,做一个 Web 版本 TodoList 应用
+
+
+# 第 0025 题: 使用 Python 实现:对着电脑吼一声,自动打开浏览器中的默认网站
+# 在文件夹0025中实现
+
+
+if __name__ == "__main__":
+ # 0000
+ # add_num(".0000/0000.jpg")
+
+ # 0001
+ # create_activation_code()
+
+ # 0002 ?????
+ # save_activation_code_to_mysql()
+
+ # 0003
+ # save_activation_code_to_redis()
+
+ # 0004
+ # number_of_words("./0004/0004.txt")
+
+ # 0005
+ # reset_images_size("./0005")
+
+ # 0006
+ # get_most_important_word("./0006")
+
+ # 0007
+ # code, note, blank_line = lines_of_codes("./0007")
+ # print("代码行数:%i\n注释行数:%i\n空行行数:%i" % (code, note, blank_line))
+
+ # 0008
+ # get_html_context("http://blog.bccn.net")
+
+ # 0009
+ # get_html_links("http://blog.bccn.net")
+
+ # 0010
+ # create_verification_code()
+
+ # 0011
+ # find_sensitive_words("./0011/0011.txt", "haha, 北京不错")
+
+ # 0012
+ # replace_sensitive_words("./0011/0011.txt", "haha, 北京不错")
+
+ # 0013
+ # get_url_imgs("http://www.ivsky.com/tupian/beijing_t1542/index_2.html")
+
+ # 0014
+ # dictxt_to_xls("./0014/student.txt")
+
+ # 0015
+ # dictxt_to_xls("./0015/city.txt")
+
+ # 0016
+ # listtxt_to_xls("./0016/numbers.txt")
+
+ # 0017
+ # student_dic = read_xls("./0017/student.xls")
+ # for key in student_dic:
+ # student = student_dic[key]
+ #
+ # dic = {}
+ # for list in student:
+ # dic[list[0]] = list[1:]
+ #
+ # write_student_to_xml(dic, "./0017/student.xml")
+ #
+ # break
+
+
+ # 0018
+ # city_dic = read_xls("./0018/city.xls")
+ # for key in city_dic:
+ # city = city_dic[key]
+ #
+ # dic = {}
+ # for list in city:
+ # dic[list[0]] = list[1:]
+ #
+ # write_city_to_xml(dic, "./0018/city.xml")
+ #
+ # break
+
+ # 0019
+ # number_dic = read_xls("./0019/numbers.xls")
+ # for key in number_dic:
+ # number = number_dic[key]
+ # write_numbers_to_xml(number, "./0019/numbers.xml")
+ #
+ # break
+
+ # 0020
+ # statistics_month_time()
+
+ # 0021
+ encrypt_password("123")
+
+ # 0022
+
+ # 0023
+
+ # 0024
+
+ # 0025
diff --git a/xyjxyf/tools/README.md b/xyjxyf/tools/README.md
new file mode 100644
index 00000000..eec10f4a
--- /dev/null
+++ b/xyjxyf/tools/README.md
@@ -0,0 +1,33 @@
+# python_tools
+
+## imager.py
+
+图片处理
+
+1. 打开
+
+2. 保存
+
+3. 大小
+
+4. 拷贝
+
+5. 裁剪
+
+6. 压缩
+
+7. 添加文字
+
+8. 旋转
+
+9. 转换色彩模式
+
+10. 生成验证码图片
+
+## checker.py
+
+检测指定的内容,可以在Xcode编译时显示警告或者错误提示
+
+## replacer.py
+
+替换指定内容
\ No newline at end of file
diff --git a/xyjxyf/tools/__init__.py b/xyjxyf/tools/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/xyjxyf/tools/colorer.py b/xyjxyf/tools/colorer.py
new file mode 100644
index 00000000..6ddcb11c
--- /dev/null
+++ b/xyjxyf/tools/colorer.py
@@ -0,0 +1,24 @@
+# coding = utf-8
+
+import random
+
+def randRGB(min=0, max=255):
+ if min < 0:
+ min = 0
+ if min > 255:
+ min = 255
+
+ if max < 0:
+ max = 0
+ if max > 255:
+ max = 255
+
+ if max < min:
+ tmp = min
+ min = max
+ max = tmp
+
+ return (random.randint(min, max),
+ random.randint(min, max),
+ random.randint(min, max))
+
diff --git a/xyjxyf/tools/dxbaiduaudio.py b/xyjxyf/tools/dxbaiduaudio.py
new file mode 100644
index 00000000..0c8a7bf4
--- /dev/null
+++ b/xyjxyf/tools/dxbaiduaudio.py
@@ -0,0 +1,115 @@
+# encoing = utf-8
+
+from urllib import request
+import json, base64, uuid, os
+import wave
+import pycurl
+import io
+
+bda_app_id = "7972313"
+bda_api_key = "ZrjLfF5Rh7pOL66gaOmDGnXn"
+bda_secret_key = "16bac9645093ca2632ebb81015ff7544"
+
+bda_access_token = ""
+bda_expires_in = ""
+ret_text = ""
+
+def get_mac_address():
+ return uuid.UUID(int=uuid.getnode()).hex[-12:]
+
+def get_access_token():
+ url = "https://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials&client_id=ZrjLfF5Rh7pOL66gaOmDGnXn&client_secret=16bac9645093ca2632ebb81015ff7544"
+
+ req = request.Request(url, method="POST")
+ resp = request.urlopen(req)
+ data = resp.read().decode('utf-8')
+ json_data = json.loads(data)
+
+ global bda_access_token
+ bda_access_token = json_data['access_token']
+
+ return bda_access_token
+
+CHUNK = 1024
+def get_wav_data(wav_path):
+ if wav_path is None or len(wav_path) == 0:
+ return None
+
+ fp = wave.open(wav_path, 'rb')
+ nf = fp.getnframes()
+ f_len = nf * 2
+ audio_data = fp.readframes(nf)
+
+ return audio_data, f_len
+
+def dump_res(buf):
+ resp_json = json.loads(buf.decode('utf-8'))
+ ret = resp_json['result']
+
+ global ret_text
+ ret_text = ret[0]
+
+ print(buf)
+
+def wav_to_text(wav_path):
+ if wav_path is None or len(wav_path) == 0:
+ return None
+
+ if len(bda_access_token) == 0:
+ get_access_token()
+ if len(bda_access_token) == 0:
+ return None
+
+ data, f_len = get_wav_data(wav_path)
+
+ url = 'http://vop.baidu.com/server_api?cuid=' + get_mac_address() + '&token=' + bda_access_token
+ http_header = [
+ 'Content-Type: audio/pcm; rate=8000',
+ 'Content-Length: %d' % f_len
+ ]
+
+ c = pycurl.Curl()
+ c.setopt(pycurl.URL, str(url)) #curl doesn't support unicode
+ #c.setopt(c.RETURNTRANSFER, 1)
+ c.setopt(c.HTTPHEADER, http_header) #must be list, not dict
+ c.setopt(c.POST, 1)
+ c.setopt(c.CONNECTTIMEOUT, 30)
+ c.setopt(c.TIMEOUT, 30)
+ c.setopt(c.WRITEFUNCTION, dump_res)
+ c.setopt(c.POSTFIELDS, data)
+ c.setopt(c.POSTFIELDSIZE, f_len)
+ c.perform() #pycurl.perform() has no return val
+
+ return ret_text
+
+
+# def wav_to_text(wav_path):
+# if wav_path is None or len(wav_path) == 0:
+# return None
+#
+# wav_data = get_wav_data(wav_path)
+# if wav_data is None:
+# return None
+#
+# if len(bda_access_token) == 0:
+# get_access_token()
+#
+# wav_base64 = base64.b64decode(wav_data)
+# print("%s", wav_base64)
+# # unicode( wav_base64, errors='ignore')
+# wav_len = len(wav_data)
+# data_dic = {'format':'wav', 'rate':8000, 'channel':1,
+# 'cuid':get_mac_address(), 'token':bda_access_token,
+# b'speech':wav_base64, 'len':wav_len}
+# json_data = json.dumps(data_dic).encode('utf-8')
+# json_len = len(json_data)
+#
+# req = request.Request('http://vop.baidu.com/server_api')
+# req.add_header('Content-Type', "application/json")
+# req.add_header("Content-Length", json_len)
+# resp = request.urlopen(req, data=json_data)
+#
+# resp_data = resp.read().decode('utf-8')
+# resp_json = json.loads(resp_data)
+#
+# return resp_json['result']
\ No newline at end of file
diff --git a/xyjxyf/tools/dxhtmlparser.py b/xyjxyf/tools/dxhtmlparser.py
new file mode 100644
index 00000000..49853b6c
--- /dev/null
+++ b/xyjxyf/tools/dxhtmlparser.py
@@ -0,0 +1,23 @@
+# encoding = utf-8
+
+from html.parser import HTMLParser
+
+
+class DXHTMLParser(HTMLParser):
+ def __init__(self, tag, tag_name, url):
+ HTMLParser.__init__(self)
+ self.tag = tag
+ self.tag_name = tag_name
+ self.url = url
+ self.rets = []
+
+ def handle_starttag(self, tag, attrs):
+ if tag == self.tag:
+ for name,value in attrs:
+ if name == self.tag_name:
+ if value.startswith("/") and len(self.url) > 0:
+ value = self.url + value
+ self.rets.append(value)
+
+ def getrets(self):
+ return self.rets
\ No newline at end of file
diff --git a/xyjxyf/tools/geturlimgs.py b/xyjxyf/tools/geturlimgs.py
new file mode 100644
index 00000000..359bb975
--- /dev/null
+++ b/xyjxyf/tools/geturlimgs.py
@@ -0,0 +1,66 @@
+# encoding = utf-8
+
+import socket, os
+from urllib import request
+from bs4 import BeautifulSoup
+
+class geturlimgs(object):
+
+ def __index__(self, to_dir=None):
+ self.to_dir = None
+
+ # 伪装浏览器,以免被封
+ def user_agent(self, url):
+ req_header = {'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6'}
+ req_timeout = 20
+ try:
+ req = request.Request(url,None,req_header)
+ html = request.urlopen(req,None,req_timeout)
+ except request.URLError as e:
+ print(e.message)
+ except socket.timeout as e:
+ # user_agent(url)
+ print("timeout")
+
+ return html
+
+ def get_img_links(self, url=None):
+ if url is None or len(url) == 0:
+ return None
+ html = self.user_agent(url)
+ soup = BeautifulSoup(html, "lxml")
+
+ count = 0
+ links = []
+ items = soup.find_all('img')
+ for item in items:
+ link = item.get('src')
+ links.append(link)
+
+ return links
+
+ def download_imgs(self, links, to_dir):
+ if links is None or len(links) == 0:
+ return
+
+ if not os.path.exists(to_dir):
+ os.makedirs(to_dir)
+
+ if not to_dir.endswith('/'):
+ to_dir = to_dir + '/'
+
+ index = 0
+ for url in links:
+ end = os.path.splitext(url)[1]
+ if len(end) == 0:
+ end = ".jpg"
+ img_path = to_dir + '%i%s' % (index, end)
+ image = request.urlretrieve(url, img_path)
+ index = index + 1
+
+ def get_imgs(self, url=None, to_dir=None):
+ if url is None or to_dir is None:
+ return None
+
+ links = self.get_img_links(url)
+ return self.download_imgs(links, to_dir)
diff --git a/xyjxyf/tools/imager.py b/xyjxyf/tools/imager.py
new file mode 100644
index 00000000..ecb14255
--- /dev/null
+++ b/xyjxyf/tools/imager.py
@@ -0,0 +1,189 @@
+# coding = utf-8
+
+from PIL import Image, ImageDraw, ImageFont, ImageFilter
+from tools import colorer, stringer
+import types, os
+
+
+# 打开
+def open_image(image_path=None):
+ if image_path is None or len(image_path) == 0:
+ return None
+
+ im = Image.open(image_path)
+ return im
+
+
+# 显示
+def show_image(image_path=None):
+ im = open_image(image_path)
+ im.show()
+
+
+# 保存
+def save(image=None, to_path=None):
+ if image is None or to_path is None or len(to_path) == 0:
+ return
+
+ f, e = os.path.splitext(to_path)
+ if e is None or len(e) == 0:
+ image.save(to_path, "JPEG")
+ else:
+ image.save(to_path)
+
+
+# 大小
+def image_size(image=None):
+ ret_size = (0, 0)
+
+ if image is None:
+ return ret_size
+
+ return image.size
+
+
+# 拷贝
+def image_copy(image=None):
+ if image is None:
+ return None
+
+ return image.copy()
+
+
+# 裁剪
+def image_crop(image=None, box=None):
+ if image is None or box is None:
+ return None
+
+ return image.crop(box)
+
+
+# 压缩
+def get_thumb(image=None, ratio=0.6):
+ if ratio > 1:
+ return image
+ if ratio <= 0 or image is None:
+ return None
+
+ w, h = image.size()
+
+ return image.thumbnail((w * ratio, h * ratio))
+
+# # 合并
+# def paste(image=None, sub_image=None, origin=(0, 0)):
+# if image is None or sub_image is None:
+# return None
+#
+# im = image
+# if type(image) is types.StringType:
+# im = Image.open(image)
+# if im is None:
+# return None
+#
+# sub_im = sub_image
+# if type(sub_image) is types.StringType:
+# sub_im = Image.open(sub_image)
+# if sub_im is None:
+# return None
+#
+# im_size = im.size
+# sub_size = sub_im.size
+# # 如果sub_image在image范围内,不需要创建新的图片
+# if origin[0] >= 0 and origin[1] >= 0:
+# right = origin[0] + sub_size[0]
+# bottom = origin[1] + sub_size[1]
+# if right <= im.size[0] and bottom <= im_size[1]:
+# return im.paste(sub_im, (origin(0), origin(1), right, bottom))
+#
+# right = im_size(0)
+# if im_size(0) < sub_size(0):
+# width = sub_size(0)
+# height = im_size(1)
+# if im_size(1) < sub_size(1):
+# height = sub_size(1)
+#
+#
+# image = Image.new('RGB', (width, height), (255, 255, 255))
+#
+#
+# return im.paste(sub_im, box)
+
+
+# 添加文字
+def draw_text(image=None, text=None, origin=(0, 0), font=None, fill='red'):
+ if image is None or text is None or len(text) == 0:
+ return None
+
+ context = ImageDraw.Draw(image)
+ context.text(origin, text, font=font, fill=fill)
+ return image
+
+
+# 旋转
+def image_rotate(image=None, rotate=0):
+
+ if image is None:
+ return None
+
+ if rotate == 0:
+ return image
+
+ return image.rotate(rotate)
+
+
+# 转换色彩模式, mode: 'P'虚化,'L'或者'1'黑白,'LA'怀旧
+def image_convert(image=None, mode='P'):
+ if image is None:
+ return None
+
+ return image.convert(mode)
+
+
+# 生成验证码图片:数字和字母
+def verification_code(num=4, width=240, height=60, font_size=30):
+ image = Image.new('RGB', (width, height), (255, 255, 255))
+ font = ImageFont.truetype('Arial.ttf', font_size)
+ draw = ImageDraw.Draw(image)
+
+ # 背景填充
+ for x in range(width):
+ for y in range(height):
+ draw.point((x, y), colorer.randRGB(min=64))
+
+ # 文字
+ tw = width / num
+ margin = (tw - font_size) / 2
+ ty = (height - font_size) / 2
+ tx = margin
+ str = ""
+ for t in range(num):
+ char = stringer.rand_char()
+ draw.text((tx, ty), char, font=font, fill=colorer.randRGB(0, 100))
+ tx = tx + tw
+ str = str + char
+
+ # 模糊效果
+ image = image.filter(ImageFilter.BLUR)
+
+ return image, str
+
+# 生成中文验证码
+
+# 重置图片大小
+def reset_image_size(image=None, max_width=None, max_height=None):
+ if image is None or max_width is None or max_height is None:
+ return
+
+ if image.size[0] <= max_width and image.size[1] <= max_height:
+ return
+
+ rotate = image.size[0] / image.size[1]
+ if rotate > 1:
+ new_width = max_width
+ new_height = max_width / rotate
+ else:
+ new_height = max_height
+ new_width = max_height * rotate
+
+ new_image = image.resize((int(new_width), int(new_height)), Image.BILINEAR)
+ return new_image
diff --git a/xyjxyf/tools/stringer.py b/xyjxyf/tools/stringer.py
new file mode 100644
index 00000000..546dce86
--- /dev/null
+++ b/xyjxyf/tools/stringer.py
@@ -0,0 +1,76 @@
+# coding = utf-8
+
+import random, string
+
+# def Unicode():
+# val = random.randint(0x4E00, 0x9FBF)
+# return unichr(val)
+#
+# # 随机汉字
+# def GB2312():
+# head = random.randint(0xB0, 0xCF)
+# body = random.randint(0xA, 0xF)
+# tail = random.randint(0, 0xF)
+# val = ( head << 8 ) | (body << 4) | tail
+# str = "%x" % val
+# return str.decode('hex').decode('gb2312')
+
+# 随机字母
+def rand_char():
+ return chr(random.randint(65, 90))
+
+# 随机字母或者数字
+def rand_choice():
+ str = 'abcdefghigklmnopqrstuvwxyzQWERTYUIOPASDFGHJKLZXCVBNM1234567890'
+ return random.choice(str)
+
+# 将字典转为json格式
+def dict_to_json(object=None, begin_indent="", indent=u'\t', newl=u'\n'):
+ if object is None:
+ return None
+
+ if type(object) is not dict:
+ return None
+
+ ret_str = u'{' + newl
+ space = begin_indent + indent
+ for key in object:
+ ret_str = ret_str + space + key + ": "
+ item = object[key]
+ ret_str = ret_str + u'%s,' % str(item)
+ # if type(item) is list:
+ # list_to_json(item)
+ # elif type(item) is dict:
+ # dict_to_json(item)
+ # else:
+ # str
+ ret_str = ret_str + begin_indent + newl
+
+ ret_str = ret_str + begin_indent + u'}'
+
+ return ret_str
+
+
+# 将数组转为json格式
+def list_to_json(object=None, begin_indent="", indent=u'\t', newl=u'\n'):
+ if object is None:
+ return None
+
+ if type(object) is not list:
+ return None
+
+ ret_str = u'[' + newl
+ space = begin_indent + indent
+ for item in object:
+ ret_str = ret_str + space + u'%s,' % str(item)
+ # if type(item) is list:
+ # list_to_json(item)
+ # elif type(item) is dict:
+ # dict_to_json(item)
+ # else:
+ # str
+ ret_str = ret_str + begin_indent + newl
+
+ ret_str = ret_str + begin_indent + u']'
+
+ return ret_str
\ No newline at end of file
diff --git a/xyjxyf/tools/test.py b/xyjxyf/tools/test.py
new file mode 100644
index 00000000..52a91f05
--- /dev/null
+++ b/xyjxyf/tools/test.py
@@ -0,0 +1,6 @@
+# coding = utf-8
+
+from tools import imager
+
+im, str = imager.verification_code()
+im.show()
\ No newline at end of file
diff --git a/yefan/001/001.py b/yefan/001/001.py
new file mode 100644
index 00000000..278a307a
--- /dev/null
+++ b/yefan/001/001.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+分析
+其实要生成激活码(邀请码)也是很简单的事, 比如随机生成.或者使用GUID,UUID等,非常简单
+
+但是我们得考虑存入以及验证的问题.
+
+这里我参考产生唯一随机码的方法分析。这篇文章的思路:
+
+主键+随机码的方式.
+
+这种方法优点:使用也比较简单,不用直接去查询数据库,而最大的优点是查询的时候,可以根据邀请码直接得到主键id, 然后根据id去数据库查询(速度很快),再比较查询出来的邀请码和用户提交的邀请码是否一致。
+
+生成:id(数据库primary key )->16进制 + "L(标识符)" +随机码
+获取id:获取16进制的id再转回10进制
+"""
+
+
+import random
+import string
+
+def activation_code(id,length=10):
+ '''
+ id + L + 随机码
+ string模块中的3个函数:string.letters,string.printable,string.printable
+ '''
+ prefix = hex(int(id))[2:]+ 'L'
+ length = length - len(prefix)
+ chars=string.ascii_letters+string.digits
+ return prefix + ''.join([random.choice(chars) for i in range(length)])
+
+def get_id(code):
+ ''' Hex to Dec '''
+ return str(int(code.upper(), 16))
+
+if __name__=="__main__":
+ for i in range(10,500,35):
+ code = activation_code(i)
+ id_hex = code.split('L')[0]
+ id = get_id(id_hex)
+ print code,id
diff --git a/yefan/004/004.py b/yefan/004/004.py
new file mode 100644
index 00000000..f6eac70f
--- /dev/null
+++ b/yefan/004/004.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+python实现任一个英文的纯文本文件,统计其中的单词出现的个数、行数、字符数
+"""
+
+file_name = "movie.txt"
+
+line_counts = 0
+word_counts = 0
+character_counts = 0
+
+with open('C:\Python27\oneday_one\movie.txt', 'r') as f:
+ for line in f:
+ words = line.split()
+
+ line_counts += 1
+ word_counts += len(words)
+ character_counts += len(line)
+
+print "line_counts ", line_counts
+print "word_counts ", word_counts
+print "character_counts ", character_counts
diff --git a/yefan/007/007.py b/yefan/007/007.py
new file mode 100644
index 00000000..d19f1406
--- /dev/null
+++ b/yefan/007/007.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+
+
+#list all the files in your path(完整路径名path\**.py)
+import os
+def get_files(path):
+ files=os.listdir(path)
+ files_path=[]
+ for fi in files:
+ fi_path= path+'\\' + fi
+ if os.path.isfile(fi_path):
+ if fi.split('.')[-1]=='py':
+ files_path.append(fi_path)
+ elif(os.path.isdir(fi_path)):
+ files_path+=get_files(fi_path)
+ return files_path
+
+# Count lines and blank lines and note lines in designated files
+def count_lines(files):
+ line, blank, note = 0, 0, 0
+ for filename in files:
+ f = open(filename, 'rb')
+ for l in f:
+ l = l.strip()
+ line += 1
+ if l == '':
+ blank += 1
+ elif l[0] == '#' or l[0] == '/':
+ note += 1
+ f.close()
+ return (line, blank, note)
+
+if __name__ == '__main__':
+ a=r'c:\python27'
+ #files = get_files(r'c:\python27\oneday_one')
+ files = get_files(r'F\v6:')
+ print len(files),files
+ lines = count_lines(files)
+ print 'Line(s): %d, black line(s): %d, note line(s): %d' % (lines[0], lines[1], lines[2])
+
diff --git a/yefan/008/008.py b/yefan/008/008.py
new file mode 100644
index 00000000..1bebe4da
--- /dev/null
+++ b/yefan/008/008.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+#coding=utf-8
+
+"""
+第 0008 题:一个HTML文件,找出里面的正文。
+"""
+
+from bs4 import BeautifulSoup
+
+def find_the_content(path):
+ with open(path) as f:
+ text = BeautifulSoup(f, 'lxml')
+ content = text.get_text().strip('\n')
+
+ return content.encode('gbk','ignore')
+
+
+if __name__ == '__main__':
+ print find_the_content(r'D:\Show-Me-the-Code_show-me-the-code_1.html')
diff --git a/yefan/009/009.py b/yefan/009/009.py
new file mode 100644
index 00000000..14c8ec00
--- /dev/null
+++ b/yefan/009/009.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+#coding=utf-8
+
+"""
+第 0009 题:一个HTML文件,找出里面的链接
+"""
+
+from bs4 import BeautifulSoup
+
+def find_the_link(filepath):
+ links = []
+ with open(filepath) as f:
+ bs =BeautifulSoup(f,'lxml')
+ for i in bs.find_all('a'):
+ links.append(i['href'])
+ return links
+
+if __name__ == '__main__':
+ #print find_the_link('D:\Show-Me-the-Code_show-me-the-code_1.html')
+
diff --git a/yefan/011/011.py b/yefan/011/011.py
new file mode 100644
index 00000000..df43c831
--- /dev/null
+++ b/yefan/011/011.py
@@ -0,0 +1,28 @@
+#!/bin/env python
+# -*- coding: utf-8 -*-
+import codecs
+def read_txt():
+ l=[]
+ with codecs.open(r'c:\python27\oneday_one\1.txt') as fp:
+ for line in fp.readlines():
+ l.append(line.strip())
+ return l
+
+def check(l):
+ word=raw_input('word:')
+ for each_word in l:
+ if word==each_word:
+ print 'Freedom'
+ return None
+ print 'Human rights'
+ return None
+
+def main():
+ l=read_txt()
+ check(l)
+ print l
+
+if __name__=='__main__':
+ main()
+
+
diff --git a/yefan/013/013.py b/yefan/013/013.py
new file mode 100644
index 00000000..cd5e8167
--- /dev/null
+++ b/yefan/013/013.py
@@ -0,0 +1,39 @@
+#!/usr/bin/python
+# coding=utf-8
+
+"""
+第 0013 题: 用 Python 写一个爬图片的程序,爬 这个链接里的日本妹子图片 :-)
+"""
+
+import os
+import urllib
+from bs4 import BeautifulSoup
+from urlparse import urlsplit
+import re
+
+def catch_tieba_pics(url):
+ content =urllib.urlopen(url)
+ print type(content)
+ #f.write(content.read())
+ bs = BeautifulSoup(content, 'lxml')
+ print type(bs)
+ print bs.prettify() ################
+ for i in bs.find_all('img', {"class": "BDE_Image"}):
+ download_pic(i['src'])
+
+def download_pic(url):
+ image_content = urllib.urlopen(url).read()
+ file_name = os.path.basename(urlsplit(url)[2])
+ output = open(file_name, 'wb')
+ output.write(image_content)
+ output.close()
+
+
+if __name__ == '__main__':
+ #catch_tieba_pics('http://tieba.baidu.com/p/2166231880')
+ catch_tieba_pics('http://tieba.baidu.com/p/4203526008')
+ #catch_tieba_pics('http://www.zhihu.com/question/22995735')
+
+"""
+为什么知乎的网页print内容只有一点点
+"""
diff --git a/yefan/014/014.py b/yefan/014/014.py
new file mode 100644
index 00000000..3a5ae5c2
--- /dev/null
+++ b/yefan/014/014.py
@@ -0,0 +1,17 @@
+# coding = utf-8
+__author__ = 'Forec'
+import xlwt
+import re
+
+book = xlwt.Workbook(encoding = 'utf-8', style_compression=0)
+sheet = book.add_sheet('student',cell_overwrite_ok = True)
+line = 0
+info = re.compile(r'\"(\d+)\":\[\"(.*?)\",(\d+),(\d+),(\d+)\]')
+with open('student.txt',"r") as f:
+ data = f.read()
+ data=data.decode('gbk').encode('utf-8')
+for x in info.findall(data):
+ for i in range(len(x)):
+ sheet.write(line,i,x[i])
+ line+=1
+book.save('student.xls')
diff --git a/Jimmy66/0014/0014.py b/yefan/014/14.py
similarity index 85%
rename from Jimmy66/0014/0014.py
rename to yefan/014/14.py
index 602f4cd5..18acf36d 100644
--- a/Jimmy66/0014/0014.py
+++ b/yefan/014/14.py
@@ -1,39 +1,41 @@
-#!/bin/env python
-# -*- coding: utf-8 -*-
-
-#导入模块
-import simplejson as json
-import xlwt
-
-#从文件(JSON形式)中读取数据返回字典
-def read_file(filename):
- with open(filename,'r') as fp:
- content = fp.read()
- #simplejson这个模块还没细看,怎么解码还是需要了解下
- d = json.JSONDecoder().decode(content)
- return d
-
-#生成对应的xls文件
-def gen_xls(d,filename):
- fp = xlwt.Workbook()
- table = fp.add_sheet('student',cell_overwrite_ok=True)
- #试了下,与很多要转utf-8(ASCII码)存文件的情况不同,xls不接受ASCII码形式的存储,直接用字典里面的Unicode就行了,简直好评,不用在特意decode或者encode了
- #想写得更加自动化一些,好复用.本身不太想用两层循环的,不过也不知道有没有更便捷的存储方式(比如整行自动匹配导入,算法是背后优化封装好的,就用了万能的这种方法)
- for n in range(len(d)):
- table.write(n,0,n+1)
- m = 0
- for record in d[str(n+1)]:
- table.write(n,m+1,record)
- m += 1
- fp.save('student.xls')
- print '写入完毕'
-
-#主函数,嘛,最后还是用“丑陋的二重循环”实现了,但是其实也没什么,还是要看场景和优化,毕竟这也不是做查找或者排序,在日常使用中也不用太担心性能问题
-def main():
- filename = 'student.txt'
- xls_name = 'student.xls'
- d = read_file(filename)
- gen_xls(d,xls_name)
-
-if __name__ == '__main__':
- main()
+#!/bin/env python
+# -*- coding: utf-8 -*-
+
+#导入模块
+import simplejson as json
+import xlwt
+
+#从文件(JSON形式)中读取数据返回字典
+def read_file(filename):
+ with open(r'C:\Python27\oneday_one\student.txt','r') as fp:
+ content = fp.read().decode('gbk').encode('utf-8')
+ #print type(content)
+ #simplejson这个模块还没细看,怎么解码还是需要了解下
+ d = json.JSONDecoder().decode(content)
+ #d=json.loads(content)
+ return d
+
+#生成对应的xls文件
+def gen_xls(d,filename):
+ fp = xlwt.Workbook()
+ table = fp.add_sheet('student',cell_overwrite_ok=True)
+ #试了下,与很多要转utf-8(ASCII码)存文件的情况不同,xls不接受ASCII码形式的存储,直接用字典里面的Unicode就行了,简直好评,不用在特意decode或者encode了
+ #想写得更加自动化一些,好复用.本身不太想用两层循环的,不过也不知道有没有更便捷的存储方式(比如整行自动匹配导入,算法是背后优化封装好的,就用了万能的这种方法)
+ for n in range(len(d)):
+ table.write(n,0,n+1)
+ m = 0
+ for record in d[str(n+1)]:
+ table.write(n,m+1,record)
+ m += 1
+ fp.save('student.xls')
+ print u'写入完毕'
+
+#主函数,嘛,最后还是用“丑陋的二重循环”实现了,但是其实也没什么,还是要看场景和优化,毕竟这也不是做查找或者排序,在日常使用中也不用太担心性能问题
+def main():
+ filename = 'student.txt'
+ xls_name = 'student.xls'
+ d = read_file(filename)
+ gen_xls(d,xls_name)
+
+if __name__ == '__main__':
+ main()
diff --git a/yefan/014/student.txt b/yefan/014/student.txt
new file mode 100644
index 00000000..ddb4a149
--- /dev/null
+++ b/yefan/014/student.txt
@@ -0,0 +1,5 @@
+{
+ "1":["",150,120,100],
+ "2":["",90,99,95],
+ "3":["",60,66,68]
+}
\ No newline at end of file
diff --git a/yefan/014/student.xls b/yefan/014/student.xls
new file mode 100644
index 00000000..c392c6f5
Binary files /dev/null and b/yefan/014/student.xls differ
diff --git a/yefan/015/015.py b/yefan/015/015.py
new file mode 100644
index 00000000..79fb4590
--- /dev/null
+++ b/yefan/015/015.py
@@ -0,0 +1,16 @@
+# coding = utf-8
+__author__ = 'Forec'
+import xlwt
+import re
+
+book = xlwt.Workbook(encoding = 'utf-8',style_compression=0)
+sheet = book.add_sheet('number',cell_overwrite_ok = True)
+line = 0
+info = re.compile(r'\[(\d+),\s+(\d+),\s+(\d+)\]')
+with open(r'c:\python27\oneday_one\numbers.txt',"r") as f:
+ data = f.read().decode('gbk').encode('utf-8')
+for x in info.findall(data):
+ for i in range(len(x)):
+ sheet.write(line,i,x[i])
+ line+=1
+book.save('numbers.xls')
diff --git a/yefan/015/city.txt b/yefan/015/city.txt
new file mode 100644
index 00000000..4d62a75c
--- /dev/null
+++ b/yefan/015/city.txt
@@ -0,0 +1,5 @@
+{
+ "1" : "Ϻ",
+ "2" : "",
+ "3" : "ɶ"
+}
\ No newline at end of file
diff --git a/yefan/015/city.xls b/yefan/015/city.xls
new file mode 100644
index 00000000..b020435b
Binary files /dev/null and b/yefan/015/city.xls differ
diff --git a/yefan/015/city.xls~HEAD b/yefan/015/city.xls~HEAD
new file mode 100644
index 00000000..b020435b
Binary files /dev/null and b/yefan/015/city.xls~HEAD differ
diff --git a/yefan/015/city.xls~upstream_master b/yefan/015/city.xls~upstream_master
new file mode 100644
index 00000000..b020435b
Binary files /dev/null and b/yefan/015/city.xls~upstream_master differ
diff --git a/yefan/020/020.py b/yefan/020/020.py
new file mode 100644
index 00000000..4f8cf398
--- /dev/null
+++ b/yefan/020/020.py
@@ -0,0 +1,26 @@
+#-*- coding=utf-8
+import xlwt
+import xlrd
+import re
+
+book = xlrd.open_workbook(r'c:\python27\oneday_one\2015.xls')
+print book.sheet_names()
+sheet=book.sheet_by_index(0)
+print sheet.name,sheet.nrows,sheet.ncols
+col3=sheet.col_values(3)
+li=[]
+for i in col3:
+ li.append(i)#.encode('utf-8')
+del li[0]
+s=[0,0]
+info=re.compile(ur"(\d+)[\u4e00-\u9fa5](\d*)[\u4e00-\u9fa5]*")#匹配汉字!!!!
+for each_time in li:
+ t=info.match(each_time).groups()
+ t=list(t)
+ if u'' in t:
+ t[1],t[0]=t[0],u'0'
+ s[0]=s[0]+int(t[0])
+ s[1]=s[1]+int(t[1])
+s[0],s[1]=s[0]+int(s[1]/60),s[1]%60
+print '通话时长累计%d分%d秒'%(s[0],s[1])
+
diff --git a/yefan/020/2015.xls b/yefan/020/2015.xls
new file mode 100644
index 00000000..f0d493e5
Binary files /dev/null and b/yefan/020/2015.xls differ
diff --git a/yefan/README.md b/yefan/README.md
new file mode 100644
index 00000000..fdc2f54a
--- /dev/null
+++ b/yefan/README.md
@@ -0,0 +1 @@
+所有程序是在win7 python2.7下调试成功,其中很多借鉴了此项目下其他贡献者的代码。侵删。