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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content +
+ + + + + + + + + + +
+ +
+ +
+
+ + + +
+ + +
+
+
+
+

Built for developers

+

+ 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. +

+
+
+
+
+
+ +
+
+
+ +
+ +
+ +
+
+
+ GitHub for teams +
+

+ A better way to work together +

+

+ GitHub brings teams together to work through problems, move ideas forward, and learn from each other along the way. +

+ +
+ +
+
+
+
+ +
+
+

Write better code

+

+ 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. +

+

+ Learn about code review on GitHub +

+
+
+ +
+
+ +
+
+

Manage your chaos

+

+ 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. +

+

+ Learn about project management on GitHub +

+
+
+
+
+ +
+ +
+
+ security-admin + +
+ Security and administration +
+

+ Boxes? Check. +

+

+ 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. +

+ +

+ + Learn about GitHub for Business + +

+ +
+
+ +
+
+

Code security

+

+ 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 + +
+ 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. +

+

+ Learn about integrations +

+
+ +
+
+
+
+
+
+
+
+
+ +
+

+ Sometimes, there’s more than one tool for the job. Why not try something new? +

+

+ Browse GitHub Marketplace +

+
+
+
+ +
+
+ open-source + +
+ Community +
+

+ Welcome home,
developers +

+

+ GitHub is home to the world’s largest community of developers and their projects... +

+
+ + + + +
+ +
+
+

+ 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content +
+ + + + + + + + + + +
+ +
+ +
+
+ + + +
+ + +
+
+
+
+

Built for developers

+

+ 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. +

+
+
+
+
+
+ +
+
+
+ +
+ +
+ +
+
+
+ GitHub for teams +
+

+ A better way to work together +

+

+ GitHub brings teams together to work through problems, move ideas forward, and learn from each other along the way. +

+ +
+ +
+
+
+
+ +
+
+

Write better code

+

+ 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. +

+

+ Learn about code review on GitHub +

+
+
+ +
+
+ +
+
+

Manage your chaos

+

+ 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. +

+

+ Learn about project management on GitHub +

+
+
+
+
+ +
+ +
+
+ security-admin + +
+ Security and administration +
+

+ Boxes? Check. +

+

+ 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. +

+ +

+ + Learn about GitHub for Business + +

+ +
+
+ +
+
+

Code security

+

+ 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 + +
+ 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. +

+

+ Learn about integrations +

+
+ +
+
+
+
+
+
+
+
+
+ +
+

+ Sometimes, there’s more than one tool for the job. Why not try something new? +

+

+ Browse GitHub Marketplace +

+
+
+
+ +
+
+ open-source + +
+ Community +
+

+ Welcome home,
developers +

+

+ GitHub is home to the world’s largest community of developers and their projects... +

+
+ + + + +
+ +
+
+

+ 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/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