diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..ffddd2c Binary files /dev/null and b/.DS_Store differ diff --git a/.github/workflows/hugo.yaml b/.github/workflows/hugo.yaml new file mode 100644 index 0000000..e5f14bf --- /dev/null +++ b/.github/workflows/hugo.yaml @@ -0,0 +1,78 @@ +# Sample workflow for building and deploying a Hugo site to GitHub Pages +name: Deploy Hugo site to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: + - main + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +# Default to bash +defaults: + run: + shell: bash + +jobs: + # Build job + build: + runs-on: ubuntu-latest + env: + HUGO_VERSION: 0.121.0 + steps: + - name: Install Hugo CLI + run: | + wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ + && sudo dpkg -i ${{ runner.temp }}/hugo.deb + - name: Install Dart Sass + run: sudo snap install dart-sass + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + - name: Setup Pages + id: pages + uses: actions/configure-pages@v4 + - name: Install Node.js dependencies + run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" + - name: Build with Hugo + env: + # For maximum backward compatibility with Hugo modules + HUGO_ENVIRONMENT: production + HUGO_ENV: production + run: | + hugo \ + --gc \ + --minify \ + --baseURL "${{ steps.pages.outputs.base_url }}/" + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 + with: + path: ./public + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v3 \ No newline at end of file diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..c6f3fce --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,5 @@ ++++ +title = '{{ replace .File.ContentBaseName "-" " " | title }}' +date = {{ .Date }} +draft = true ++++ diff --git a/archives/2018/01/index.html b/archives/2018/01/index.html deleted file mode 100644 index f91d552..0000000 --- a/archives/2018/01/index.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/archives/2018/index.html b/archives/2018/index.html deleted file mode 100644 index f91d552..0000000 --- a/archives/2018/index.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/archives/2019/01/index.html b/archives/2019/01/index.html deleted file mode 100644 index b907ec4..0000000 --- a/archives/2019/01/index.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/archives/2019/02/index.html b/archives/2019/02/index.html deleted file mode 100644 index b4e0d60..0000000 --- a/archives/2019/02/index.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/archives/2019/03/index.html b/archives/2019/03/index.html deleted file mode 100644 index aff9a44..0000000 --- a/archives/2019/03/index.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/archives/2019/04/index.html b/archives/2019/04/index.html deleted file mode 100644 index 3abcd68..0000000 --- a/archives/2019/04/index.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/archives/2019/index.html b/archives/2019/index.html deleted file mode 100644 index 37206de..0000000 --- a/archives/2019/index.html +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/archives/2020/01/index.html b/archives/2020/01/index.html deleted file mode 100644 index ada423c..0000000 --- a/archives/2020/01/index.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/archives/2020/02/index.html b/archives/2020/02/index.html deleted file mode 100644 index c0dcf13..0000000 --- a/archives/2020/02/index.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/archives/2020/index.html b/archives/2020/index.html deleted file mode 100644 index 7a6041b..0000000 --- a/archives/2020/index.html +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/archives/index.html b/archives/index.html deleted file mode 100644 index da79ee2..0000000 --- a/archives/index.html +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/article/about/index.html b/article/about/index.html deleted file mode 100644 index 5d682ed..0000000 --- a/article/about/index.html +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 关于我们 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

关于我们

-
- Author:flypython | Date: 2018-01-01 | Category:Python入门 -
-
-
-
-
-

关于我们

http://flypython.com

-

关于FlyPython

FlyPython是提供一站式Python编程学习的组织,我们致力于为用户提供高效,有趣的学习环境,打造专注于Python的中文学习社区。

-

联系我们

客服&合作: 微信号 flypython

-

公众号二维码

FlyPython

-

FlyPython训练营

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-class-01/index.html b/article/python-class-01/index.html deleted file mode 100644 index 7225f1b..0000000 --- a/article/python-class-01/index.html +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 为什么在今年,你需要学习Python | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

为什么在今年,你需要学习Python

-
- Author:flypython | Date: 2020-01-01 | Category:飞蟒微课堂 -
-
-
-
-
-

你是否在朋友圈看过Python培训的广告? 你在微博是否刷出过大佬在学Python的新闻?你会惊讶,为什么现在都在大肆宣传Python,今天我就给你答案。

-

IT行业发展日新月异,每天你都会听到很多新兴技术和编程语言以及他们的最新进展。

-

对于那些对学哪种编程语言更适合,感觉困惑的初学者,其实不用担心,FlyPython为你提供了一个计划。我们不用需要学习三大编程语言,五大框架的谎言来骗你。相反,我们将只关注一种语言,那就是Python。

-

让我们从一个有趣的事实开始。在现在流行的编程语言中,Python是最受欢迎。你可以通过在各种榜单上来确认这一事实。

-

为什么要学习Python?

-

你可能会想到的第一个问题是“为什么要专门学习Python?”。嗯,这个问题的答案很简单。

-

考虑一下要包含在编程语言中的因素。

-

1.学习能力

Python很难吗?一点也不!Python是很多人的第二语言,现在越来越多人开始作为第一语言学习。Python语言旨在简化了复杂的编程,它削减了所有低级任务,并为你执行所需的任何任务提供了高级抽象。Python基础语法非常简单,你可以通过一个月的练习轻松掌握它。

-

2.提高生产力

学习了编程语言后,打算做什么?你是否要构建应用程序,Web服务,令人兴奋的游戏,自动化重复性任务,执行复杂的科学或数字计算或从某些数据挖掘观点,Python让你无所不能。它是目前最有生产力的语言之一。

-

3.高薪

学习Python是你今天可以做出的最好的投资。Python开发人员的薪水很高,尤其是在Web开发,机器学习和数据科学领域。薪资范围从10k起,具体取决于地点和你在行业中的经验。IT行业对Python开发人员的需求很大,因此你在市场上找到Python职位不会有任何麻烦。

-

Python应用方向

使用Python可以做的事情没有限制,但是在这里我们将向你介绍一些最重要的Python实际应用,以提示你可以在哪里实际使用Python编程语言。

-

-

1.网站开发

Python是快速开发Web应用程序的理想选择。借助Django,Tornado,Flask等许多框架,Python使你可以快速构建Web应用程序。Python用于Web开发的服务器端,你可以使用Python与数据库进行交互并构建REST API服务。

-

2.数据科学

早期的Python主要用于构建应用程序和编写脚本以自动执行任务,但是现在,数据科学使Python更加流行。数据科学人员非常依赖Python,因为它的优点包括简单,强大的社区以及轻松计算等功能。在数据科学领域流行的Python库和框架是:

-
    -
  • Pandas(数据分析)
  • -
  • Numpy(数值和科学计算)
  • -
  • Matplotlib,Seaborn(数据可视化)
  • -
  • Scikit-learn(机器学习)
  • -
  • Tensorflow,Keras,Pytorch(深度学习)
  • -
-

3.人工智能

不久的将来将是人工智能时代。过去,计算机被用来以很高的速度执行数学计算,但是现在,许多大型组织和研究人员正在致力于构建可以像人类一样执行任务的智能系统。机器在某种程度上足以理解人类的情感及其自然语言。它们可以模仿人类以前无法完成的某些动作。同样,Python在构建AI系统方面很受欢迎。

-

下面列出了一些用于构建智能系统的Python库 :

-
    -
  • NLTK (自然语言工具包)
  • -
  • OpenCV (开源计算机视觉库)
  • -
  • Rasa (开源聊天机器人库)
  • -
-

4.自动化

有许多重复性的与业务相关的任务。Python可以通过自动执行任务来简化工作,例如,抓取网站来收集数据,编写测试用例,自动化办公任务。
Python可以轻松访问和读取所有类型的文件,这通过自动执行重复任务为节省大量时间提供了机会。用于自动化的框架或库是:

-
    -
  • Robot Framework
  • -
  • PyTest
  • -
  • PyUnit
  • -
-

Python在不同领域中的使用增长非常迅速,并且没有停止的迹象。可以肯定地说,Python将在这个瞬息万变的IT行业中会长期坚持下去。

-

如何学习Python?

-

你很棒已经读到了这里,现在我知道你对编程感到兴奋,并在思考你想使用Python构建什么样程序。让我们再迈出一步,为自己制定一个计划,以有效地学习Python。

-

FlyPython推出了飞蟒微课堂,希望能给学员一些学习Python的路径指导。

-

-

你的Python学习之路可以遵从以下7个步骤:

-

步骤1:加强基础

一切都从头开始,了解与编程相关的术语和概念。因此,请在你的计算机上安装Python,然后开始学习Python编程语言的基本语法,变量和数据类型

-

步骤2:了解决策和控制流程

熟悉基础知识后,了解了如何使用编程语言进行决策判断。有多种不同的方法,例如if和else语句,可让根据条件进行决策。循环也是所有编程语言的重要组成部分。您可以使用循环轻松地执行重复性任务,并通过实现不同类型的循环(例如For循环,while循环和嵌套循环)来学习概念。

-

步骤3:掌握面向对象的编程

面向对象编程是一种通过考虑对象和类形式的现实世界实体来解决所有问题的方法。为了成为一名更好的程序员,必须了解面向对象编程的概念和原理。在构建大型应用程序时,,面向对象设计是有益的,它通过重用可用组件来帮助我们编写简洁的代码。它们也易于维护。

-

步骤4:使用框架创建Web应用

在Web开发环境中,Python用于Web应用程序的服务器端编程。我们使用HTML,CSS和JavaScript来定义网站的外观以及过渡效果和动画。这也称为应用程序的前端。应用程序的后端涉及处理来自浏览器或前端的请求,从数据库检索数据并执行操作。Python管理所有这些与服务器端相关的任务。用于Web开发的最受欢迎的Python框架是Django。另一个流行的框架是Flask。这些框架提供了应用程序的快速开发。因此,你可以选择其中任何一个,并通过创建具有基本CRUD操作的Web应用程序来创建一个小项目。

-

步骤5:掌握数据科学的技能

数据科学和机器学习的世界在很大程度上取决于Python。我们开始介绍机器学习算法的类型,通过实现不同的机器学习模型来练习编程。使用Pandas库分析数据,使用Numpy库执行数值计算,使用scikit-learn构建机器学习模型,并使用matplotlib或seaborn等库可视化数据。

-

步骤6:Python机器学习项目

环顾四周,思考可以解决哪些问题。创建一个项目构想列表,并从你学到的所有东西中构建出一些东西。通过集成所有内容来进行大型项目。你可以通过向用户提供某种形式的服务来构建机器学习模型并将其与网站集成。

-

准备从头开始创建Python项目:

-
    -
  • 虚假新闻检测
  • -
  • 音频情感识别
  • -
  • 聊天机器人
  • -
  • 交通标志识别
  • -
-

我们会从最初的数据准备开始,构建机器学习pipeline,教你真正的机器学习项目实战。

-

步骤7:Python面试

Python面试分为两个部分,第一部分是数据结构算法准备阶段,主要是Leetcode真题解析。第二部分是各大厂面试真题解析,带你实战。

-

飞蟒微课堂更新计划

微课堂推出7个免费的专项课程来对应上面的7个步骤。照顾到不同的同学基础各不相同,课程之间相互独立,我们会同时更新不同的课程,最后把整个课程体系完善。

-

目前的计划会同时启动Python面试和Python语法课程,请关注公众号FlyPython和飞蟒官网。

-

课程访问资源

-

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-class-02/index.html b/article/python-class-02/index.html deleted file mode 100644 index 342e5c2..0000000 --- a/article/python-class-02/index.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 飞蟒微课堂Python面试专项课程启动——LeetCode刷题计划 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

飞蟒微课堂Python面试专项课程启动——LeetCode刷题计划

-
- Author:flypython | Date: 2020-01-02 | Category:飞蟒微课堂LeetCode -
-
-
-
-
-

LeetCode刷题计划

我至今面试过几百人,发现很多候选人基础确实有不少的问题,尤其是转专业的同学。

-

大多数的公司面试工程师时都会考察这几个方面,

-
    -
  • 数据结构与算法,一般为leetcode题目
  • -
  • 简历上的项目探讨与深入研究
  • -
  • 业务场景设计题
  • -
-

按照不同的职位,会增加相应的内容。比如算法工程师,会问机器学习与深度学习算法,如果有paper和比赛,也会问一些。但是一般前两轮都是数据结构和算法,所以数据结构与算法是敲门砖,希望同学们能在这方面多下些功夫。

-

Python面试专项课程分为两部分,一是刷leetcode,二是公司面试真题。完整的题解目录请在FlyPython公众号菜单上查看,这次主要介绍leetcode,面试真题后面会有具体的介绍。

-

那怎么刷LeetCode呢?你可以根据自己的实际情况来决定,如果时间充裕可以通过题型来分类,每个题型都刷10题左右。如果时间紧张,建议刷热门题和公司题库,提高命中率。你也可以每周参加leetcode的周赛,来维持手感。

-

真正做到bug free,确实很难,有的时候刷2-3遍也不行,得多做变型题,多想多总结,不断积累基础就变扎实了。难度以中等为主,兼顾hard。

-

这次的LeetCode刷题计划,是以leetcode中文站的精选TOP面试题为基础的,题目共145道,希望对同学们有帮助。

- -

附:LeetCode练手题

还没有注册LeetCode的同学,先去注册一个并完成下面的的练手题。还没有关注FlyPython的同学长按最后的二维码关注我吧。

-

LCP 1. 猜数字

链接:https://leetcode-cn.com/problems/guess-numbers/
难度:简单

-

题目

-

小A 和 小B 在玩猜数字。小B 每次从 1, 2, 3 中随机选择一个,小A 每次也从 1, 2, 3 中选择一个猜。他们一共进行三次这个游戏,请返回 小A 猜对了几次?

-

输入的guess数组为 小A 每次的猜测,answer数组为 小B 每次的选择。guess和answer的长度都等于3。

-

示例 1:

-

输入:guess = [1,2,3], answer = [1,2,3]
输出:3
解释:小A 每次都猜对了。

-

示例 2:

-

输入:guess = [2,2,3], answer = [3,2,1]
输出:1
解释:小A 只猜对了第二次。

-

限制:

-

guess的长度 = 3
answer的长度 = 3
guess的元素取值为 {1, 2, 3} 之一。
answer的元素取值为 {1, 2, 3} 之一。

-
-

题解

leetcode最简单的练手题,可以循环比较计数,也可以直接三个元素比较。

-

解法

-

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-cs224n-01/index.html b/article/python-cs224n-01/index.html deleted file mode 100644 index 6edcf09..0000000 --- a/article/python-cs224n-01/index.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cs224n 解答拾遗: 为何word2vec 训练的时候每个词有两个不同的向量 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

cs224n 解答拾遗: 为何word2vec 训练的时候每个词有两个不同的向量

-
- Author:flypython | Date: 2020-01-01 | Category:自然语言处理cs224n -
-
-
-
-
-

1.前言:为何一个词有2个向量

-

在cs224n 2019课程中的L1和L2中,我们详细论述了word2vec skip-gram 模型,相信大家都已经掌握了。

-
-

但这里有一个细节,肯定让不少同学非常疑惑。
视频中提到,一个词有2个向量,总参数是2d*V。

-

-

(Lecture 01 Introduction and Word Vectors,ppt第23页)提到了use two vectors per word

-

-

(Lecture 01 Introduction and Word Vectors,ppt第27页)

-

如上图示,在训练过程中是存在2个词向量的。这怎么理解?明明一个词最终输出的时候,只有一个词向量呀。

-

2.word2vec回顾

在视频中,Manning教授简单提了一嘴,我们这里详细说明一下,word2vec为什么要在训练的时候使用2个词向量,这2个词向量是什么关系,最终输出的是什么词向量。

-

这2个词向量一个是词$w$的word representations ($v_w$) 在下图中表示为V,一个是该词w的context representations ($u_w$)在下图中表示为U。

-

-

(Lecture 02 Word Vectors 2 and Word Senses ppt第4页)

-

在我们训练词向量的时候,对于训练语料,使得P(o|c)的概率最大,也就是
J=-logP(o|c)最小(如果没有负号则是求最大,cs224n视频的ppt就没有负号)。

-

我们是怎么定义P(o|c)的呢?

-

定义如下:

-

$P(o|c)={exp(u_o^Tv_c)}/{\sum_{w=1}^V exp(u_w^Tv_c)}$

-

可以看到,这个条件概率是中心词和上下文词2个词向量的点乘,再取e的指数,并除以所有词的词向量和中心词的点乘取e的指数之和,公式的本质是一个向量点乘+softmax。

-

这里当w是o 中心词的时候,使用词的word representations,而w是c上下文词的时候,使用词的context representations。

-

3.问:为什么要这么做呢,为什么不都使用同一个词向量呢?

答:使用2个词向量的目的是,训练时我们需要让具有相同上下文的词的词向量相互接近,但我们不希望这些词的上下文的词也相互接近。

-

以下面2句话的例子讲解一下:

-

the dog has a tail

-

the cat has a tail

-

这里采用word2vec skip-gram ,naive softmax 模型,窗口大小采用k=1。

-

对于中心词dog来说,需要计算:

-

P(dog|has)

-

P(dog|the)

-

对于中心词cat来说,需要计算:

-

P(cat|has)

-

P(cat|the)

-

这里的条件概率公式是上面的:
$P(o|c)={exp(u_o^Tv_c)}/{\sum_{w=1}^V exp(u_w^Tv_c)}$

-

分别把中心词dog/cat 和上下文词has/the带入,就可求出概率。
对于目标函数J=-logP(o|c),我们要求其最小值,那么在word2vec算法中,需要做梯度下降算法。这里使用sgd,只需要对每个样本进行梯度下降,如下公式:

-

$u_o(new)=u_o(old)-\alpha \partial J/(\partial u_o)$

-

$v_c(new)=v_c(old)-\alpha \partial J/(\partial v_c)$

-

多次迭代sgd后,会使得J变小,而$u_o$和$v_c$的点乘会变大,进而使得两者余弦距离接近。那么如果dog/cat 分别和has/the 接近了,dog和cat的词余弦距离就会接近。

-

假设这里$u_o$和$v_c$都是同一种向量,那么不光dog和cat的词余弦距离接近,cat和has也会相近,连has和the都会相近。

-

但是我们希望最后输出的词向量,dog和cat相近,但不希望cat和has相近,也不希望has和the相近。如果都相近,词就没有区分度了。

-

所以我们对于每个词采用双词向量,对于dog 这个词,有一个word representations ($v_c$) 用来作为中心词时计算,有一个context representations ($u_o$)作为上下文词时进行计算。

-

context representations训练为了使得中心词word representations相近,context representations作为中间结果不输出,而word representations作为最终结果输出。这样就避免了所有中心词的词向量都接近的困境了。

-

最终,我们保存中心词的word representations,既公式中的$v_c$ 。

-

4.考古

解释清楚这个问题以后,我们知道最早的算法是否使用2个vec的。

-

在word2vec提出者,Tomas Mikolov 的论文Distributed Representations of Words and Phrases and their Compositionality
和他提供的word2vec.c代码里,训练过程中,每个word都存在2个词向量。

-

如下图

论文Distributed Representations of Words and Phrases and their Compositionality 中截图

-


word2vec.c代码截图

-

所以我们清楚了,最早的word2vec算法确实在训练的时候是存在2个vec的。

-

5.参考文献:

https://www.quora.com/Why-does-word2vec-have-two-different-representation-for-words

-

论文:Distributed Representations of Words and Phrases
and their Compositionality

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-cs224n-02/index.html b/article/python-cs224n-02/index.html deleted file mode 100644 index af66e11..0000000 --- a/article/python-cs224n-02/index.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cs224n 解答拾遗:word embedding 之SVD分解 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

cs224n 解答拾遗:word embedding 之SVD分解

-
- Author:flypython | Date: 2020-01-02 | Category:自然语言处理cs224n -
-
-
-
-
-
-

老师,请问共现矩阵奇异值分解后为什么是用U的行来做word embedding呢?

-
-

cs224n课程第一周里,提到了2种生成word embedding的方法。
一种是基于word2vec的神经网络生成词向量的方法。
另一种是基于统计的词向量生成的方法:使用共现矩阵,再进行SVD分解。

-

-

首先要说明,这2种方法输出的word embedding 都是distributed representation(稠密表达)。

-

其次值得说的是,这2种方法各有优缺点(可能面试里会问),在glove方法中,综合进行了两种算法,达到最优的效果。

-

那么,我们这里详细探讨一下利用SVD生成词向量的过程,解答上面提到的问题。

-
-

共现矩阵奇异值分解后为什么是用U的行来做word embedding

-
-

1.生成共现矩阵(Window based Co-occurrence Matrix)

构造一个矩阵X,这个矩阵的大小是 $V*V$ ,这里V是词表的长度。这个矩阵称之为共现矩阵。

-

我们要统计,每个中心词在左右k个窗口的范围内,上下文词出现的词频。于是这里的共现矩阵,第一个维度(列),代表这个中心词,第二个维度(行)代表这个中心词对应的上下文词。
$X={x_{ij}}$为第i个词作为中心词时,对应第j个词作为其上下文词时候的词频。

-

我们还是用课上的例子,有3句话:

-
1
2
3
I enjoy flying。
I like NLP。
I like deep learning。
- -

假设这里k=1,统计的共现矩阵X为:

-

可以看出,这里的共现矩阵X为对称矩阵,也就是对中心词like,enjoy的出现次数是等于对于中心词enjoy,like的出现次数。

-

2.SVD分解的过程

假设X的size是$VV$,那么U的矩阵是$VK$,奇异值矩阵S是$KK$,而$V^T$的矩阵size 是$KV$.
这里V是词表长度,上面解释了,K是指最后需要输出的词向量维度,一般我们取100-300之间的一个值。

-

SVD分解公式可以写作
$X=USV^T$
写成分量式为:

-

$x_{ij}= \sum_{k=1}^n u_{ij}s_kv_{jk}$

-

那么从这个公式看出,对于每个样本word $x_{ij}$ 与$u_{ij}$是对于的,而不是与$v^T_j$对应,$v^T_j$与每个维度对应。

-

这里需要解释一下我们是如何得到SVD分解公式的:

由线性代数基本知识可知,对于任意矩阵X(size $V*V$ )来说,我们可以进行奇异值分解,

-

$X=U \Lambda V^T$,

-

这里, $U, V, \Lambda$都是size $V*V$ 的对角矩阵,并且每个值都是非负实数,按大小从大到小排列。

-

-

那么我们对$\Lambda$进行降维,只保留前K个值,这样U和V也会跟着变,从维度上看,矩阵U去掉了后面的一些列,变成了$VK$;矩阵$V^T$,去掉了前面的一些行,变成了$KV$(实质上做了空间变换,而不是简单的去除一些数据)。也就是上面的图:

-

这里就解释了,为什么是用U的行来做word embedding。

-

3.如果U对应的词向量,那么V对应的是什么呢?

还有一个问题,如果U对应的词向量,那么V对应的是什么呢?对于词共现矩阵来说,V的意义还不是很清晰,我们考虑这样一个矩阵:

-

词-文档矩阵 Word-Document Matrix,行是所有的词,维度为V,列是每个文档,维度为M。

-

对这样一个矩阵进行SVD分解,并降维到K个奇异值上取值,

-

-

SVD分解公式可以写作
$X=U\Sigma V^T$

-

U的矩阵size$V*K$,

-

$V^T$的矩阵size 是$K*V$

-

写成分量式为:

-

$x_{ij}= \sum_{k=1}^n u_{ij}\sigma_kv_{jk}$

-

$u_{ij}$ 对应的第i个词和第j个主题的相关度,$u_{i}是词的主题向量$。

-

$v_{jk}$ 对应第j个文档和第k个主题的相关度,所以$v_j$是第j个文档的文档向量。

-

这样就说明了V在SVD分解的意义。

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-leetcode-0000/index.html b/article/python-leetcode-0000/index.html deleted file mode 100644 index cbdeda9..0000000 --- a/article/python-leetcode-0000/index.html +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0000.为什么需要复杂度分析 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

0000.为什么需要复杂度分析

-
- Author:flypython | Date: 2020-02-24 | Category:飞蟒微课堂LeetCode -
-
-
-
-
-

写在前面

FlyPython推出的《Python面试专项课程》原计划在春节假期后开始更新,考虑到后面刷题的需求可能增多,我们对题目进行了调整并于今天开始更新。

-

原先的LeetCode刷题计划中的精选TOP面试题推后,我们先过一遍《程序员面试金典》这本书上的面试题,为基础薄弱的同学夯实基础。

- -

欢迎关注我们的公众号flypython和网站flypython.com,我们将持续更新这个专项课程。

-

为什么需要复杂度分析

今天是这个专项课程的第0课,我们带来算法学习最重要的一个部分:复杂度分析。

-

为什么说复杂度分析是最重要呢?因为数据结构和算法其实解决的是”快”和”省”的问题。”快”就是如何让代码运行得更快,”省”就是让代码节约存储空间。怎么样来衡量你编写的算法代码执行效率呢?这里引出来今天要讲的内容:时间、空间复杂度分析。

-

你可能会说,不就是执行效率么?我把代码跑一遍,增加cProfile的一些操作,不就得到了执行时间和内存占用么。

-

其实你上面说的也是一种方法,叫事后统计法,在做性能优化时会大量采用。但是事后统计法有它的局限性。第一,它依赖测试环境,测试环境不一样,得到的数据会都不一样;第二,它受数据规模的影响大,比如排序,排10个数和排100万个数肯定不一样。所以我们不能以具体测试数据来表示,需要的是一个估算的执行效率的方法。这个方法就是我们要讲的大O复杂度表示法。

-

大O复杂度表示法

我们从一个例子开始,下面是求1,2,3,…n的累加和的代码

-
1
2
3
4
5
6
7
8
1 int cal(int n) {
2 int sum = 0;
3 int i = 1;
4 for (; i <= n; ++i) {
5 sum = sum + i;
6 }
7 return sum;
8 }
- -

我们假设每一行代码的执行时间是相同的,为unit_time,那么这一段代码,第2,3行执行了一次,4,5行执行了n遍,第7行执行了一次,那总共执行的次数2n+3,执行时间为(2n+3)* unit_time。

-

可以看出,所有代码的执行时间 T(n) 与每行代码的执行次数成正比。可以用以下公式表示:

-

-

其中T(n)为所有代码的执行时间
其中f(n)表示每行代码执行的次数总和

-

公式中的O,表示代码的执行时间 T(n) 与 f(n) 表达式成正比。我们的例子中,T(n)=O(2n+3),这就是大O时间复杂度表示法。

-

大 O 时间复杂度实际上并不具体表示代码真正的执行时间,而是表示代码执行时间随数据规模增长的变化趋势,所以,也叫作渐进时间复杂度(asymptotic time complexity),简称时间复杂度。

-

时间复杂度分析

    -
  • O(1): 常数
  • -
  • O(logn): 对数
  • -
  • O(n): 线性
  • -
  • O(nlogn):线性对数
  • -
  • O(n^2): 平⽅
  • -
  • O(n^3): 立⽅
  • -
  • O(n^k): K次方
  • -
  • O(2^n): 指数
  • -
  • O(n!): 阶乘
  • -
-
O(1)
1
2
int a=0;
int b=a;
- -

O(1) 只是常量级时间复杂度的一种表示方法,并不是指只执行了一行代码。只要代码的执行时间不随 n 的增大而增长,这样代码的时间复杂度我们都记作 O(1)。

-
O(log n)
1
2
3
for(int i=1; i<n; i=i*2){
printf(i);
}
- -

对数阶时间复杂度非常常见,同时也是最难分析的一种时间复杂度。从代码中可以看出,变量 i 的值从 1 开始取,每循环一次就乘以 2。当大于 n 时,循环结束。还记得我们高中学过的等比数列吗?实际上,变量 i 的取值就是一个等比数列

-

-

通过 2^x = n 求解 x, x=log2n,这段代码的时间复杂度就是 O(log2n),忽略系数,表示为O(logn)。

-
O(n)
1
2
3
for(int i=1; i<=n; i++){
printf(i);
}
- -

for循环代码执行了n遍,因此它消耗的时间是随着n的变化而变化的,所以通过O(n)来表示。如果平行存在一个for循环m遍的,如下:

-
1
2
3
4
5
6
7
for(int i=1; i<=n; i++){
printf(i);
}

for(int i=1; i<=m; i++){
printf(i);
}
- -

那时间复杂度为O(m+n)。

-
O(nlogn)
1
2
3
4
5
for(int i=1; i<=n; i++){
for(int j=1; j<=n;j=j*2) {
printf(i,j);
}
}
- -

线性对数O(nlogn)就是将时间复杂度为O(logn)的代码循环N遍的话,那么它的时间复杂度就是n* O(logn),也就是了O(nlogn)

-
O(n^2)
1
2
3
4
5
for(int i=1; i<=n; i++){
for(int j=1; j<=n;j++) {
printf(i,j);
}
}
- -

平方就是O(n)代码再嵌套循环一遍,2层n循环,O(n * n) 为O(n^2)。如果嵌套3层n循环,则为O(n^3),如果嵌套k层,则为O(n^k)。

-

如果其中一层循环中的n改为m,如下所示:

-
1
2
3
4
5
for(int i=1; i<=m; i++){
for(int j=1; j<=n;j++) {
printf(i,j);
}
}
- -

那它的时间复杂度为O(m * n)

-
O(2^n)和O(n!)
1
2
3
for(int i=1; i<=math.pow(2,n); i++){
printf(i);
}
- -
1
2
3
for(int i=1; i<=factorial(n); i++){
printf(i);
}
- -

以上两个代码例子分别为O(2^n)复杂度和O(n!)复杂度,指数复杂度和阶乘复杂度属于非多项式量级,我们把时间复杂度为非多项式量级的算法问题叫作 NP(Non-Deterministic Polynomial,非确定多项式)问题。

-

当数据规模 n 越来越大时,非多项式量级算法的执行时间会急剧增加,求解问题的执行时间会无限增长。所以,非多项式时间复杂度的算法其实是非常低效的算法。

-

具体增长曲线如下图所示:

-

-

空间复杂度分析

    -
  • O(1)
  • -
  • O(n)
  • -
  • O(n²)
  • -
-
O(1)
1
2
3
int i=0;
int j=1;
int m = i + j;
- -

代码中的i,j,m不随着处理数据量变化而变化,算法需要的临时空间是固定的,可以表示为空间复杂度O(1)

-
O(n)
1
2
3
4
5
int[] m = new int[n];
for(i=1; i<=n; ++i)
{
printf(i);
}
- -

这段代码中,第一行new了一个数组出来,这个数据占用的大小为n,这段代码的2-5行,虽然有循环,但没有再分配新的空间,所以这段代码的空间复杂度为O(n)

-
O(n^2)

平方空间复杂度与O(n)类似,new出来的数组如果是n * n的多维数组,那就是O(n^2)复杂度,如果是m * n的多维数组,那就是O(m * n)复杂度。

-
1
2
int[][] a = new int[n][n];
int[][] a = new int[m][n];
- -

总结

今天我们学习了复杂度分析的相关基础知识,包括了时间复杂度和空间复杂度,主要是用来分析算法执行效率与数据规模之间的增长关系。

-

常见的复杂度,从低阶到高阶有:O(1)、O(logn)、O(n)、O(nlogn)、O(n^2),几乎包括了后面学习的所有数据结构和算法的复杂度,希望大家可以好好的掌握。

-

-

时间复杂度分析还有最好,最坏,平均,均摊时间复杂度等话题需要好好讨论,请关注后续文章,我们会在刷题过程中穿插讲解。

-

参考资料

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-leetcode-lcci0101/index.html b/article/python-leetcode-lcci0101/index.html deleted file mode 100644 index 3e800aa..0000000 --- a/article/python-leetcode-lcci0101/index.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LCCI 01.01.判定字符是否唯一 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

LCCI 01.01.判定字符是否唯一

-
- Author:flypython | Date: 2020-02-25 | Category:飞蟒微课堂LeetCode -
-
-
-
-
-

01.01.判定字符是否唯一

链接:https://leetcode-cn.com/problems/is-unique-lcci/
难度:简单

-

题目

-

实现一个算法,确定一个字符串 s 的所有字符是否全都不同。

-

示例 1:

-

输入: s = “leetcode”
输出: false
示例 2:

-

输入: s = “abc”
输出: true

-

限制:

-

0 <= len(s) <= 100
如果你不使用额外的数据结构,会很加分。

-
-

思路

首先,你得理解题意。不确定的东西,需要问或者尝试验证。

-

比如:这里你可以问面试官字符串s是ASCII还是Unicode字符串,如果是编程平台你可以写测试来判断。

-

在这里我们假定字符集为ASCII,那如果字符串长度大于128,那肯定是false,不过有限制条件len(s)<=100,那这个判断就不必要了。限制里面还要求不使用额外的数据结构,这就过滤掉了很多的方案。

-

比如,使用set就一行代码解决

-
1
2
3
class Solution:
def isUnique(self, astr: str) -> bool:
return len(astr)== len(set(astr))
- -

我们很容易想到hash计数的方法,经过测试,字符串中只出现’a’到’z’,26个小写字母,那只需要一个bool数组,直接统计出现的频率,判断是否重复。

-

考虑到不使用额外的数据结构,那我们可以尝试使用bitmap,把数组换成一个整型数,按照位上0,1来判断是否重复。

-

开始我们算出字符离最开始的字符’a’的距离,然后1移动这个距离来表示这个数。后面用一个测试变量来测试p,如果存在则返回False,如果不存在则写入。

-

具体代码:

-
def isUnique(self, astr: str) -> bool:
-    t = 0
-    for c in astr:
-        if t & (p := 1 << (ord(c) - ord('a'))):
-            return False
-        t |= p
-    return True

在解答中使用了Python3.8的新特性:海象运算符,点击下面的链接,学习使用它。
https://mp.weixin.qq.com/s/3xKdt-26guYHoFb3xP0muw

-

方案代码

解法:

-
1
2
3
4
5
6
7
8
class Solution:
def isUnique(self, astr: str) -> bool:
t = 0
for c in astr:
if t & (p := 1 << (ord(c) - ord('a'))):
return False
t |= p
return True
- -

另外还有三种使用数据结构的解法

-

解法1:

-
1
2
3
class Solution:
def isUnique(self, astr: str) -> bool:
return len(astr)== len(set(astr))
- -

解法2:

-
1
2
3
4
5
6
7
8
9
class Solution:
def isUnique(self, astr: str) -> bool:
adict={}
for value in astr:
if value in adict.keys():
return False
else:
adict[value]=0
return True
- -

解法3:

-
1
2
3
4
5
6
7
8
9
class Solution:
def isUnique(self, astr: str) -> bool:
l=[]
for i in astr:
if i in l:
return False
else:
l.append(i)
return True
- - -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-leetcode-lcci0102/index.html b/article/python-leetcode-lcci0102/index.html deleted file mode 100644 index 2603efb..0000000 --- a/article/python-leetcode-lcci0102/index.html +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LCCI 01.02.判定是否互为字符重排 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

LCCI 01.02.判定是否互为字符重排

-
- Author:flypython | Date: 2020-02-26 | Category:飞蟒微课堂LeetCode -
-
-
-
-
-

01.02.判定是否互为字符重排

链接:https://leetcode-cn.com/problems/check-permutation-lcci/
难度:简单

-

题目

-

给定两个字符串 s1 和 s2,请编写一个程序,确定其中一个字符串的字符重新排列后,能否变成另一个字符串。

-

示例 1:

-

输入: s1 = “abc”, s2 = “bca”
输出: true
示例 2:

-

输入: s1 = “abc”, s2 = “bad”
输出: false

-

说明:
0 <= len(s1) <= 100
0 <= len(s2) <= 100

-
-

思路

开始,我们还是先理解题意,确定是否区分大小写,是否忽略空白字符等。有了01.01题的hash计数0,1判断的经历,在这里很容易想到使用hash计数。

-

因为字符可以重复,需要对字符进行计数,这个时候我们会想到collections库中的Counter。于是有了下面两行代码解决了问题。

-
1
2
from collections import Counter
return Counter(s1) == Counter(s2)
- -

但是上面的方法严格来说算作弊,那我们手写吧。对每个字符进行计数操作并测试是否相等,不相等返回False,全部相等返回True。

-
1
2
3
4
5
6
7
8
9
10
class Solution:
def CheckPermutation(self, s1: str, s2: str) -> bool:
if len(s1) != len(s2):
return False

base = set(s1+s2)
for b in base:
if s1.count(b) != s2.count(b):
return False
return True
- -

上面的代码,最容易出问题的是base = set(s1+s2),需要以两个字符串集的唯一字符来进行计数,但这里引入了set。

-

我们测试了字符范围,发现是’a’到’z’,那么代码可以改成:

-
1
2
3
4
5
6
7
8
9
10
class Solution:
def CheckPermutation(self, s1: str, s2: str) -> bool:
if len(s1) != len(s2):
return False

base = [chr(i) for i in range(ord("a"),ord("z")+1)]
for b in base:
if s1.count(b) != s2.count(b):
return False
return True
- -

再进一步,为了直观,我们可以引入string包,代码如下:

-
1
2
3
4
5
6
7
8
9
10
class Solution:
def CheckPermutation(self, s1: str, s2: str) -> bool:
import string
if len(s1) != len(s2):
return False

for b in string.ascii_lowercase:
if s1.count(b) != s2.count(b):
return False
return True
- -

当然,在这里我们也可以通过排序并比较来解决,代码非常简单:

-
1
2
3
class Solution:
def CheckPermutation(self, s1: str, s2: str) -> bool:
return sorted(s1) == sorted(s2)
- -

空间复杂度O(nlogn),相比hash计数复杂度要高一些,但是hash计数有空间复杂度。

-

错误代码分析

在题解中看到一份代码

-
1
2
3
4
5
6
7
8
9
10
11
12
13
class Solution {
public boolean CheckPermutation(String s1, String s2) {
if(s1.length() != s2.length()) {
return false;
}
int s1Sum = 0, s2Sum = 0;
for(int i = 0; i < s1.length(); i++) {
s1Sum += s1.charAt(i);
s2Sum += s2.charAt(i);
}
return s1Sum == s2Sum;
}
}
- -

此解法主要是计算s1,s2字符和,比较字符和。这种解法的问题就是忽略了和相同,但数字并不同的情况,比如 3+7 == 2+8。

-

除了计算s1,s2的字符和外,计算相对位移和,加s1字符减s2字符等方法都有此问题。

-

方案代码

解法:

-
1
2
3
4
5
6
7
8
9
10
class Solution:
def CheckPermutation(self, s1: str, s2: str) -> bool:
if len(s1) != len(s2):
return False

base = set(s1+s2)
for b in base:
if s1.count(b) != s2.count(b):
return False
return True
- -

另外含高级数据结构的三种解法

-

解法1:

-
1
2
3
4
class Solution:
def CheckPermutation(self, s1: str, s2: str) -> bool:
from collections import Counter
return Counter(s1) == Counter(s2)
- -

解法2:

-
1
2
3
class Solution:
def CheckPermutation(self, s1: str, s2: str) -> bool:
return sorted(s1) == sorted(s2)
- -

解法3:

-
1
2
3
4
5
6
7
8
9
10
class Solution:
def CheckPermutation(self, s1: str, s2: str) -> bool:
import string
if len(s1) != len(s2):
return False

for b in string.ascii_lowercase:
if s1.count(b) != s2.count(b):
return False
return True
- - -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-new-01/index.html b/article/python-new-01/index.html deleted file mode 100644 index e19020d..0000000 --- a/article/python-new-01/index.html +++ /dev/null @@ -1,169 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Python 3.8新特性——赋值表达式 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

Python 3.8新特性——赋值表达式

-
- Author:flypython | Date: 2019-04-01 | Category:Python新特性 -
-
-
-
-
-

上周,Python3.8版本发布,到底带来了哪些新的特性呢?我们应该在哪些场景中使用这些特性呢?本周,我们通过几篇文章来告诉你答案。

-

-

安装

首先,我们并不推荐安装最新版本到常用的开发环境中,你可以使用虚拟环境或者docker来尝鲜。

-

官方安装包

-

网址:https://www.python.org/downloads/release/python-380/

-

也可以使用docker

-

拉取镜像命令
docker pull python:3.8

-

赋值表达式

-

赋值表达式被叫做海象运算符,因为它的形状像海象。如果熟悉go语言的话,会对这个表达式会熟悉。

-

赋值表达式的语法是

-
1
name := expression
- -

和赋值语句 = 作用差不多,非必不可少,但可以简化代码。

-

官方示例

1
2
3
4
5
>>> a = False
>>> print(a)
False
>>> print(a := True)
True
- -

此例子赋值之后,后续还需要使用变量。赋值表达可用于简化代码,提高可读性。

-
1
2
3
4
5
6
7
8
9
10
11
12
13
>>> inputs = list()
>>> while True:
... current = input("your input:")
... if current == "quit":
... break
... inputs.append(current)
...
your input:a
your input:b
your input:test
your input:quit
>>> inputs
['a', 'b', 'test']
- -

使用赋值操作符时:

-
1
2
3
4
5
6
7
8
9
10
>>> inputs = list()
>>> while (current := input("your input:")) != "quit":
... inputs.append(current)
...
your input:a
your input:b
your input:test
your input:quit
>>> inputs
['a', 'b', 'test']
- -

此例子,省略了一条语句,可读性上升。

-

再来一个例子

-

最初版本

-
1
2
3
a = [1,2,3,4]
if len(a) > 3: #计算 len(a) 一次
print(f"a is too long ({len(a)} elements,expected < 3)") # 计算 len(a) 第二次
- -

我们改写为:

-

改进版本

-
1
2
3
4
a = [1,2,3,4]
n = len(a) # 计算一次len(a)
if n > 3: # 多了变量n
print(f"a is too long ({n} elements,expected < 3)") #
- -

新特性重写:
重写版本

-
1
2
3
a = [1,2,3,4]
if (n:=len(a)) > 3: # 计算一次len(a),多了变量n,把两行改为一行
print(f"a is too long ({n} elements,expected < 3)") #
- -

从上面可以看到,重写版本和改进版本的不同在于:

-
1
2
3
n = len(a) 
if n > 3:
pass
- - -

-
1
2
if (n:=len(a)) > 3:
pass
- -

这两个版本的区别在于,:==是补充关系并不是替换关系,下面的例子可以看到官方的意图。

-
1
2
3
4
5
6
7
8
9
x = 5
print(f"x = {x}")

#能用=解决的就用=解决
y := 5 # SyntaxError: invalid syntax
print(f"y = {y}")

(z := 5)
print(f"z = {z}")
- -

由上面可以看出:==是互补关系,在应该使用:=的时候才可以使用:=

-

Python语言的一致性,不管是专家还是新手,在同一个问题上都应该有一致的写法,然后这就形成了最pythonic的写法。

-

最后带来,新特性带来的最佳实践

-
1
2
3
4
5
6
7
8
9
# 简化 os.fork 
if pid := os.fork():
# Parent code
else:
# Child code

# 直接到把 socket 对象的 read buffer 读完为止
while data := sock.recv(8192):
print("Received data:", data)
- -

参考

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-new-02/index.html b/article/python-new-02/index.html deleted file mode 100644 index 9f1330e..0000000 --- a/article/python-new-02/index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Python 3.8新特性——仅限位置形参 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

Python 3.8新特性——仅限位置形参

-
- Author:flypython | Date: 2019-04-02 | Category:Python新特性 -
-
-
-
-
-

仅限位置形参

Positional-only parameters官方翻译为仅限位置形参,也可以理解为只接受位置参数。意思就是,它只是一个位置参数,不接受关键字传参。

-

语法:

-
1
2
def funx(a,b,/): # / 指明,前面的a,b参数是仅限位置形参
pass
- -

函数形参语法/ 用来指明某些函数形参必须使用仅限位置而非关键字参数

-

其实,Python内置的很多C函数接口都是这种形式,比如

-
1
2
3
4
5
6
>>> import builtins
>>> help(__builtins__.divmod)
Help on built-in function divmod in module builtins:

divmod(x, y, /)
Return the tuple (x//y, x%y). Invariant: div*y + mod == x.
- -

很多函数后面都有 /来表明,左边的这些参数只接受位置参数。

-
1
2
3
4
5
6
7
>>> divmod(1,2)
(0, 1)
>>> divmod(x=1,y=2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: divmod() takes no keyword arguments
>>>
- -

指定关键字的参数会报语法错误,它的用途就是强制使用者用位置参数来传参。

-

官方例子

1
2
3
4
5
>>> def f(a,b,/,**kwargs):
... print(a,b,kwargs)
...
>>> f(10,20,a=1,b=2,c=3)
10 20 {'a': 1, 'b': 2, 'c': 3}
- -

由于在 / 左侧的形参不会被公开为可用关键字

-

这里的a,b 为仅限位置参数,最后a,b会被赋值了两次。
位置参数赋值一次,关键字参数赋值一次,关键字参数以kwargs字典的形式存在,需要通过 kwargs['a'],kwargs['b']访问。

-

现在我们来看一下,添加了仅限位置形参之后的函数参数形式

-
1
2
def name(positional_only_parameters, /, positional_or_keyword_parameters,
*, keyword_only_parameters):
- -

包括了仅限位置形参, /, 位置形参或者关键字参数 ,*,仅限关键字参数。

-

-

最后,我们可以定义以下形式的函数

-
1
2
3
4
5
6
def name(p1, p2, /, p_or_kw, *, kw):
def name(p1, p2=None, /, p_or_kw=None, *, kw):
def name(p1, p2=None, /, *, kw):
def name(p1, p2=None, /):
def name(p1, p2, /, p_or_kw):
def name(p1, p2, /):
- -

参考

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-nlp-01/index.html b/article/python-nlp-01/index.html deleted file mode 100644 index 864332d..0000000 --- a/article/python-nlp-01/index.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 使用 Python 生成《红楼梦》词云 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

使用 Python 生成《红楼梦》词云

-
- Author:flypython | Date: 2019-03-01 | Category:自然语言处理 -
-
-
-
-
-

使用 Python 生成《红楼梦》词云

-

-

本文介绍如何使用python绘制《红楼梦》的词云。

-
-

“词云”就是对网络文本中出现频率较高的“关键词”予以视觉上的突出,形成“关键词云层”或“关键词渲染”,从而过滤掉大量的文本信息,使浏览网页者只要一眼扫过文本就可以领略文本的主旨。
“词云”——网络内容发布新招式 .人民网

-
-

0.摘要

本文建议在电脑上打开,边阅读边操作。

-
    -
  1. 安装python词云工具wordcloud,画图软件matplotlib
  2. -
  3. 准备红楼梦文本
  4. -
  5. 编写python代码并运行
  6. -
  7. 展示词云结果
  8. -
-

1.安装wordcloud

可以在cmd窗口输入

-

pip install wordcloud matplotlib

-

-

2.准备红楼梦文本

文本可以用下面链接下载

-

https://github.com/flypythoncom/flypython/blob/master/wordcloud_hlm_seg.txt

-

或者可以自己写代码,对文本进行清洗,分词。
这里需要安装jieba分词,pip install jieba

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

import jieba
import re

special_character_removal = re.compile(r'[,。、【 】“”:;()《》‘’{}?!⑦%>℃.^-——=&#@¥『』]', re.IGNORECASE)

fw=open("hlm_seg.txt","w",encoding="utf-8")

with open('hlm.txt',encoding="utf-8") as fp:
for line in fp:
l = special_character_removal.sub('', line.strip())
words=jieba.cut(l)
t=" ".join(words)
fw.write(t)
fw.write("\n")

fw.close()
- -

3. 编写词云python代码并运行

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

from os import path
from wordcloud import WordCloud

d = path.dirname(__file__)
# Read the whole text.
text = open(path.join(d, 'hlm_seg.txt'),encoding="utf-8").read()
# Generate a word cloud image
# font=path.join(d, "simkai.ttf")
font='C:/Windows/Fonts/simkai.ttf'
wordcloud = WordCloud(font_path=font,#设置中文字体,不指定就会出现中文不显示
width=1024,#宽
height=840,#高
background_color='white',#设置背景色
# max_words=100,#最大词汇数
# max_font_size=100#最大号字体
).generate(text)

# Display the generated image:
# the matplotlib way:
import matplotlib.pyplot as plt

plt.figure()
plt.imshow(wordcloud)
plt.axis("off")
plt.show()
- -

结果:

-

词云运行结果

-

后台回复“词云”获得完整运行代码

-

人生苦短,我用python早下班。如果觉得不错,对你工作中有帮助,请加我微信公众号flypython,我们一起探讨python相关问题

-

flypython微信公众号

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-oa-01/index.html b/article/python-oa-01/index.html deleted file mode 100644 index 94d7457..0000000 --- a/article/python-oa-01/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Python写入Excel表格 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

Python写入Excel表格

-
- Author:flypython | Date: 2019-01-01 | Category:自动化办公 -
-
-
-
-
-

【极简Python 自动化办公】Python写入Excel表格

-

【极简Python 自动化办公】专栏是介绍如何利用python办公,减少工作负荷。篇幅精炼,内容易懂,无论是否有编程基础,都非常适合。

-
-

在上次文章中,我们学习了【用python读取excel】,这次我们继续学习Python写excel吧!

-

-

0.摘要

本文大约需要15分钟,建议在电脑上打开,边阅读边操作。

-
    -
  1. 安装Python读excel模块——xlwt
  2. -
  3. 准备写入表格内容
  4. -
  5. 编写python代码并运行
  6. -
  7. 使用for循环语句读取并写入excel表格
  8. -
-

1.安装xlwt

与上篇文章类似,需要在cmd窗口输入

install xlwt```。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
![](http://jcjview.github.io/img/flypythonpythonexcelw2.png)

## 2.准备写入表格内容

这步很简单,只要想好输入内容即可,这里设计了一个简单的表格内容作为写入内容(目前这个内容还不存在)。

| 序号  | 学号 |年龄 |
| --- | --- |--- |
| 张三 | 20190901 |11|
| 李四 |20190902|12 |
| 小明 | 20190903 |13 |

## 3.编写python代码并运行

新建一个writeexcel.py文件,用记事本或其他文本编辑工具打开。

本次写入excel的思路是,新建文件->指定行列->写入内容。

在文本编辑工具中输入如下代码,保存并关闭。

-

import xlwt

-

f = xlwt.Workbook()
sheet1 = f.add_sheet(‘sheet1’,cell_overwrite_ok=True)
column = [“姓名”,”学号”,”年龄”]
name = [“张三”,”李四”,”小明”]

-

school_code = [20190901,20190902,20190903]

-

age = [11,12,13]

-

sheet1.write(0,0,column[0])#第1行第1列
sheet1.write(0,1,column[1])#第3行第3列
sheet1.write(0,2,column[2])#第2行第2列

-

sheet1.write(1,0,name[0])#第2行第1列
sheet1.write(1,1,school_code[0])#第2行第1列
sheet1.write(1,2,age[0])#第3行第1列

-

sheet1.write(2,0,name[1])
sheet1.write(2,1,school_code[1])
sheet1.write(2,2,age[1])

-

sheet1.write(3,0,name[2])
sheet1.write(3,1,school_code[2])
sheet1.write(3,2,age[2])

-

f.save(‘test1.xls’)

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

还是一样,注意每句的开头不可以有空格,因为python用*缩进*来表示编程的层次,缩进不同就会报错了。


在保存writeexcel.py的位置上打开cmd,运行 python writeexcel.py
可以看到结果:
![](http://jcjview.github.io/img/flypythonpythonexcelw4.png)
![](http://jcjview.github.io/img/flypythonpythonexcelw5.png)


## 4.使用for循环语句读取并写入excel表格

非常好!您已经学会了如何读取和写入excel表格。

但是,我们只能一个一个单元格读取和写入数据,这比手工操作excel表格快不了多少。

接下来,我们需要学习使用for循环,来批量读取一个excel表格,并循环写入另一个excel表格中。

不要删除test1.xls,在test1.xls文件的位置,新建一个rwexcel.py文件,将下面代码输入到文件中:
- -

import xlrd
import xlwt

-

wb = xlrd.open_workbook(“test1.xls”)#打开文件
sheet1 = wb.sheet_by_index(0)#获取第一个表格

-

column = []#列名

-

data=[]

-

#获取列名
column.append(sheet1.cell(0,0).value)#姓名
column.append(sheet1.cell(0,1).value)#学号
column.append(sheet1.cell(0,2).value)#年龄

-

for i in range(1,sheet1.nrows):#sheet1.nrows 行数
coldata=[]
coldata.append(sheet1.cell(i, 0).value)#姓名
coldata.append(int(sheet1.cell_value(i, 1)))#学号
coldata.append(sheet1.cell(i, 2).value)#年龄
data.append(coldata)

-

f = xlwt.Workbook()
sheetw = f.add_sheet(‘sheet1’,cell_overwrite_ok=True)

-

sheetw.write(0,0,column[0])#姓名
sheetw.write(0,2,column[2])#学号
sheetw.write(0,1,column[1])#年龄

-

for i in range(len(data)):
d=data[i]
sheetw.write(i+1, 0, d[0]) # 第2行第1列
sheetw.write(i+1, 1, d[1]) # 第2行第1列
sheetw.write(i+1, 2, d[2]) # 第3行第1列

-

f.save(‘test2.xls’)

-

```

-

运行后,会生成一个test2.xls,与test1.xls一模一样。

-

人生苦短,我用python早下班。如果觉得不错,对你工作中有帮助,请加我微信公众号flypython,我们一起探讨python相关问题

-

flypython微信公众号

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-oa-02/index.html b/article/python-oa-02/index.html deleted file mode 100644 index 1db1964..0000000 --- a/article/python-oa-02/index.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Python写入Word文档 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

Python写入Word文档

-
- Author:flypython | Date: 2019-01-02 | Category:自动化办公 -
-
-
-
-
-
-

【极简Python 自动化办公】专栏是介绍如何利用python办公,减少工作负荷。篇幅精炼,内容易懂,无论是否有编程基础,都非常适合。

-
-

在上次文章中,我们学习了【用python写入excel】,这次我们学习Python写word文档吧!

-

场景:
有时候,办公室需要按模版生成的固定的文件,模板是固定的,只是每次需要替换信息。如下图的收入证明,模版中所有标黄的都是需要替换的信息:

如果手工来做这个事情,每次至少需要10分钟的时间。假如每天要开15份,则至少要花2个半小时,而且手工编辑word很容易出错。

-

可不可用python写个程序,解决这个问题呢?

-

结论当然是肯定的!

-

0.摘要

本文大约需要15分钟,建议在电脑上打开,边阅读边操作。

-
    -
  1. 安装Python读写word模块,python-docx
  2. -
  3. 准备word模板,准备写入word文档内容
  4. -
  5. 编写python代码并运行
  6. -
  7. 通过读取excel表格中的信息,批量生成word文件
  8. -
-

1.安装python-docx模块

与上篇文章类似,需要在cmd窗口输入pip install python-docx

-

2.准备word模板,准备写入word文档内容

word模板如上所示,(可以不需要标黄),这里注意,需要替换的文字或数字位置,用”XXXX”来固定替代。保存为个人收入证明.docx

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称内容
姓名张三
身份证号104111199009103531
职务工程师
工作年限10
月收入10000
大写壹万元整
联系人李四
单位名称格物致知股份有限公司
单位地址珠海市横琴新区宝华路6号105室-67425
联系电话0756-8627528
-

3. 编写python代码并运行

在word模板的同级目录,新建一个writeword.py文件,用记事本或其他文本编辑工具打开。

-

编程思路:

-
    -
  1. 用python打开对应doc模板
  2. -
  3. 按顺序找到每一个需要替换的位置字符”XXXX”,替换为对应的内容
  4. -
  5. 另存为doc为另一个文件
  6. -
-

在文本编辑工具中输入如下代码,保存并关闭。

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from docx import Document
#准备写入内容
name="张三"
id_code="104111199009103531"
career="工程师"
working_years="10"
salary="10000"
salary_uppercase="壹万元整"
contact="李四"
company="格物厚德股份有限公司"
address="珠海市横琴新区宝华路6号105室-67425"
tel="0756-8627528"
#打开doc

textlist=[name,id_code,career,working_years,salary,salary_uppercase,company,address,contact,tel]

doc = Document("个人收入证明.docx")

count=0

for p in doc.paragraphs:
        if 'XXXX' in p.text:
            inline = p.runs
            for i in range(len(inline)):
                if 'XXXX' in inline[i].text:
                    text = inline[i].text.replace('XXXX', textlist[count])
                    inline[i].text = text
                    count+=1
                    print(count)
doc.save("%s_个人收入证明.docx"%name)
- -

在同级目录,打开cmd,运行writeword.py python writeword.py

-

生成结果如下:
张三_个人收入证明.docx

-

4.通过读取excel表格中的信息,批量生成word文件

这里生成了对应word文件,但也有几个问题:

-
    -
  1. 对应的日期并没有自动填写,应当填写文件生成时对应的日期
  2. -
  3. 如果是生成大量同样word文档的话,目前的程序也需要一个一个改,并没有提升太多效率
  4. -
-

如果您看过我们之前的2篇用python读写excel的文章,您肯定就会想到,可以利用读取excel表格里的内容,批量生成对应的word文档。对,让我们继续吧!

-

这里再准备一个excel文件,将需要批量写入的信息写在excel中,并保存为income.xlsx在同级目录,如下图:

-

-

修改python 文件writeword.py

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from docx import Document
#准备写入内容
import xlrd
import time
# 当前时间元组
from datetime import datetime
nt=datetime.now()
# 可以输入中文年月日
datestr=nt.strftime('%Y{y}%m{m}%d{d}').format(y='年', m='月', d='日')

xlsx=xlrd.open_workbook('income.xlsx')
sheet=xlsx.sheet_by_index(0)
for row in range(1,sheet.nrows):
    doc = Document("个人收入证明.docx")
    count=0
    textlist=[]
    for col in range(0,sheet.ncols):
        textlist.append(str(sheet.cell_value(row, col)))

    for p in doc.paragraphs:
            if 'XXXX' in p.text:
                inline = p.runs
                for i in range(len(inline)):
                    if 'XXXX' in inline[i].text:
                        text = inline[i].text.replace('XXXX', textlist[count])
                        inline[i].text = text
                        count+=1
            if 'X 年   X 月  X 日' in p.text:
                inline = p.runs
                for i in range(len(inline)):
                    if 'X 年   X 月  X 日' in inline[i].text:
                        text = inline[i].text.replace('X 年   X 月  X 日', datestr)
                        inline[i].text = text

    doc.save("%s_个人收入证明.docx"%textlist[0])
- - -

运行后,输入结果:

-

-

-

人生苦短,我用python早下班。如果觉得不错,对你工作中有帮助,请加我微信公众号flypython,我们一起探讨python相关问题

-

flypython微信公众号

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-oa-03/index.html b/article/python-oa-03/index.html deleted file mode 100644 index 254c352..0000000 --- a/article/python-oa-03/index.html +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Python批量转换任意文档格式 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

Python批量转换任意文档格式

-
- Author:flypython | Date: 2019-01-03 | Category:自动化办公 -
-
-
-
-
-

在工作中,常常会遇到文档格式的转换。如果数据不多,手工转换就可以。如果是大量文档,那我们应该怎么办呢?

-

今天我们将使用Python来批量处理文档转换的问题.

-

关于unoconv

unoconv是一款跨平台的工具,用于格式转换,支持命令行。底层实现是依赖于开源的LibreOffice/OpenOffice。

-

项目地址:https://github.com/unoconv/unoconv

-

文档地址: http://dag.wiee.rs/home-made/unoconv/

-

根据unoconv的文档介绍,支持上百种文档格式的转换,已经覆盖了绝大部分的需求。

-

使用unoconv

安装unoconv比较繁琐,而且需要针对中文进行进一步的字符集配置。我们可以选择别人已经集成好的服务来进行操作,在这里我们选择了docker-unoconv-webservice项目。

-

项目地址为: https://github.com/zrrrzzt/docker-unoconv-webservice

-

查看项目的README,接口如下:

-

curl --form file=@myfile.docx http://localhost/unoconv/pdf > myfile.pdf

-

我们使用下列命令,先把项目的镜像pull下来

-

docker pull zrrrzzt/docker-unoconv-webservice

-

然后启动命令如下:

-

docker run -d -p 80:3000 zrrrzzt/docker-unoconv-webservice

-

服务在80端口上提供服务,如果80端口被占用,可以调整为其他的端口

-

确认服务正在运行:

-

docker ps | grep zrrrzzt/docker-unoconv-webservice

-
1
2
[flypython] docker ps | grep zrrrzzt/docker-unoconv-webservice                                         
c014cf335b31 zrrrzzt/docker-unoconv-webservice "/bin/sh -c '/usr/bi…" 2 minutes ago Up 2 minutes 0.0.0.0:80->3000/tcp brave_blackburn
- -

从docx转换为pdf:

-

curl --form file=@demo.docx http://localhost/unoconv/pdf > demo.pdf

-
1
2
3
4
5
6
[flypython] curl --form file=@demo.docx http://localhost/unoconv/pdf > demo.pdf               
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 12089 100 4242 100 7847 2532 4684 0:00:01 0:00:01 --:--:-- 7213
[flypython] ls demo*
demo.docx demo.pdf
- -

使用Python批量请求

Python批量请求的思路是,把需要转换的文档发送到服务器,服务器会返回转换后的格式,我们保存为文件就可以了。

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def post_file(url,path):
filename = os.path.basename(path)
convert_name = str(filename).split('.')[0] + '.pdf'

m = MultipartEncoder(
fields= {
'file':(filename,open(path,'rb')),
}
)
response = requests.request('POST', url, data=m, headers={'Content-Type':m.content_type})

with open(convert_name, 'wb') as f:
f.write(response.content)

return convert_name
- -

好了,更多类型转换,更完整的应用需要你根据业务来完善,这次的介绍就到这里了。demo完整代码在github上,点击原文可以获取。

-

https://github.com/flypythoncom/flypython/blob/master/convert.py

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-oa-04/index.html b/article/python-oa-04/index.html deleted file mode 100644 index 669c965..0000000 --- a/article/python-oa-04/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Python读取PDF文字和表格 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

Python读取PDF文字和表格

-
- Author:flypython | Date: 2019-01-04 | Category:自动化办公 -
-
-
-
-
-
-

【极简Python 自动化办公】专栏是介绍如何利用python办公,减少工作负荷。篇幅精炼,内容易懂,无论是否有编程基础,都非常适合。

-
-

在日常的工作中,处理PDF是最平常不过的事情了。今天带来极简Python自动化办公系列之使用Python提取Pdf文字和表格,希望能够在PDF处理上帮到你。

-

这次我们准备了一个pdf测试文件,内容如下:

-

-

pdf中包括了2页,有文字,图片和表格,覆盖了大部分pdf的场景。

-

pdfplumber介绍

Pdfplumber是一个可以处理pdf格式信息的库。它可以查找关于每个文本字符、矩阵、和行的详细信息,也可以对表格进行提取并进行可视化调试。

-

官方repo:
https://github.com/jsvine/pdfplumber

-

安装:
pip install pdfplumber

-

使用入门

1
2
3
4
5
import pdfplumber

with pdfplumber.open("test.pdf") as pdf:
first_page = pdf.pages[0] #取第一页
print(first_page.chars[0])#打印第一页第一个字文字信息
- -

结果:

-
1
{'fontname': 'CRSMRF+PingFangTC-Semibold', 'adv': Decimal('1.000'), 'upright': 1, 'x0': Decimal('57.000'), 'y0': Decimal('751.840'), 'x1': Decimal('81.000'), 'y1': Decimal('779.776'), 'width': Decimal('24.000'), 'height': Decimal('27.936'), 'size': Decimal('27.936'), 'object_type': 'char', 'page_number': 1, 'text': '关', 'top': Decimal('62.224'), 'bottom': Decimal('90.160'), 'doctop': Decimal('62.224')}
- -

格式化之后:

-

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"fontname":"CRSMRF+PingFangTC-Semibold",
"adv":"1.000",
"upright":1,
"x0":"57.000",
"y0":"751.840",
"x1":"81.000",
"y1":"779.776",
"width":"24.000",
"height":"27.936",
"size":"27.936",
"object_type":"char",
"page_number":1, #页数
"text":"关", #第一个文字
"top":"62.224",
"bottom":"90.160",
"doctop":"62.224"
}
- -

常用方法

    -
  • extract_text() 用来提页面中的文本,将页面的所有字符对象整理为一个字符串
  • -
  • extract_words() 返回的是所有的单词及其相关信息
  • -
  • extract_tables() 提取页面的表格
  • -
-

提取文字

1
2
3
4
5
6
7
8
#!/usr/bin/env python3

import pdfplumber

with pdfplumber.open("test.pdf") as pdf:
first_page = pdf.pages[0]
text = first_page.extract_text() #提取第一页的所有文字
print(text)
- -

-
1
2
3
4
5
6
7
关于我们
关于FlyPython
FlyPython是提供⼀站式Python编程学习的组织,我们致⼒于为⽤户提供⾼
效,有趣的学习环境,打造专注于Python的中⽂学习社区。
联系我们
客服&合作: 微信号 flypython
微信公众号:
- -

提取表格

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env python3

import pdfplumber
import pandas as pd

with pdfplumber.open("test.pdf") as pdf:
first_page = pdf.pages[0]
text = first_page.extract_text()
print(text)

second_page = pdf.pages[1] #第二页
table = second_page.extract_tables()#在第二页提取表格
for t in table:
df = pd.DataFrame(t[1:],columns=t[0])
print(df)
- -

-
1
2
3
4
5
         分类                 书名
0 Python入门 Python编程:从入门到\n实践
1 Python中级 流畅的Python
2
3
- -

总结

pdfplumber的接口还是很容易的,如果只是需要提取文字,几行代码就可以提取到。如果是表格并没有提取出来或者错误的提取了非表格的内容,你需要在提取表格时加入table_settings参数来指定表格的设置。

-

这次的demo中,图片并没有提取出来,pdf图片的提取会放到下一篇文章,敬请期待。

-

人生苦短,我用python早下班。如果觉得不错,对你工作中有帮助,可以长按下列二维码关注我们的公众号。

-

flypython微信公众号

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-oa-05/index.html b/article/python-oa-05/index.html deleted file mode 100644 index 50269ea..0000000 --- a/article/python-oa-05/index.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Python读取PDF图片 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

Python读取PDF图片

-
- Author:flypython | Date: 2019-01-05 | Category:自动化办公 -
-
-
-
-
-
-

【极简Python 自动化办公】专栏是介绍如何利用python办公,减少工作负荷。篇幅精炼,内容易懂,无论是否有编程基础,都非常适合。

-
-

在上次的文章中,我们从PDF中提取了文字和表格,这次我们需要提取图片。

-

还是先来看看我们上次的测试例子

-

-

这次我们要提取第一页的二维码图片。

-

fitz介绍

pymupdf是mupdf的Python绑定,而今天我们要使用的fitz是pymupdf的子模块。需要的时候,使用pip安装。

-

pip install pymupdf

-

导入的时使用import fitz导入模块。

-

更多信息可参考pymupdf的文档:
https://pymupdf.readthedocs.io/en/latest/intro/

-

提取图片

提取图片的思路是通过正则表达式找到图片对象,然后保存为图片格式。

-
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3

import fitz #pip install pymupdf
import re
import os

def find_imag(path,img_path):

checkXO = r"/Type(?= */XObject)"
checkIM = r"/Subtype(?= */Image)"

pdf = fitz.open(path)

img_count = 0
len_XREF = pdf._getXrefLength()

print("文件名:{}, 页数: {}, 对象: {}".format(path, len(pdf), len_XREF - 1))

for i in range(1, len_XREF):
text = pdf._getXrefString(i)
isXObject = re.search(checkXO, text)

# 使用正则表达式查看是否是图片
isImage = re.search(checkIM, text)

# 如果不是对象也不是图片,则continue
if not isXObject or not isImage:
continue
img_count += 1
# 根据索引生成图像
pix = fitz.Pixmap(pdf, i)

new_name = path.replace('\\', '_') + "_img{}.png".format(img_count)
new_name = new_name.replace(':', '')

# 如果pix.n<5,可以直接存为PNG
if pix.n < 5:
pix.writePNG(os.path.join(img_path, new_name))

else:
pix0 = fitz.Pixmap(fitz.csRGB, pix)
pix0.writePNG(os.path.join(img_path, new_name))
pix0 = None

pix = None

print("提取了{}张图片".format(img_count))


if __name__=='__main__':
pdf_path = r'test.pdf'
img_path = r'img'
m = find_imag(pdf_path, img_path)
- -

运行程序结果:

-
1
2
3
[pdf] python3 pdf_img.py
文件名:test.pdf, 页数: 2, 对象: 115
提取了1张图片
- -

在img目录中,已经存在了我们需要的文件

-

-

总结

pymupdf的使用,今天就简单介绍到这里。更多的功能请参考pymupdf文档。

-

下一篇,我们将带来pdf转换为图片的讨论。

-

人生苦短,我用python早下班。如果觉得不错,对你工作中有帮助,可以长按下列二维码关注我们的公众号。

-

flypython微信公众号

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-tutorial-01/index.html b/article/python-tutorial-01/index.html deleted file mode 100644 index d05f756..0000000 --- a/article/python-tutorial-01/index.html +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 你是如何自学Python的? | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

你是如何自学Python的?

-
- Author:flypython | Date: 2019-02-01 | Category:Python入门 -
-
-
-
-
-

你是如何自学 Python 的?

-

why python?

-
-

你可能听说过python

-

Python入门相对容易又可以干很多事(网站,>运维,数据,爬虫等),是一门方便的工具语言。
2019年8月TIOBE排名显示Python已经名列第3,仅次于java和c,并且还在快速增长中。

-
-

Python的使用场景

01 数据分析

对于数据分析和机器学习,Python是首选编程语言。python有众多数据分析工具,知名数据分析比赛网站kaggle,90%以上的竞赛代码都是用python写成。大数据平台如spark、flink,python有完整的支持api可调用。

-

02 网站开发

对于网站开发,Python的生态环境也可以支撑起重量级的产品。
国外的Youtube,Instagram,Pinterest,Reddit,Dropbox,Disqus, Quora等知名应用一开始都是基于Python构建,国内的豆瓣,知乎,果壳,饿了么,等初期在也是Python应用的典型。

-

03 爬虫

对于爬虫,则想不到比python更方便、更通用的的语言了。Python极其丰富的生态,诸如Request、Beautiful Soup、Scrapy、PySpider等第三方库,加上简洁易上手的语法,分分钟就能让你写出一个爬虫来。

-

此外,还有机器学习、人工智能、科学计算、IT运维等领域,Python都是极其方便顺手的工具,更重要的是,永远开源,免费。

-

Python的就业前景

在it行业飞速发展的今天,在数据成为it命脉的时代,python的重要意义越来越不言自明。学习python,不仅仅是一门可以调用数据结构和算法的语言,在学会python的同时,可以同时学会爬取互联网海量资源,学会自动化分析互联网海量数据,学会制作展示宣传的网站,学会使用人工智能预测和改变世界。

-

学习一门语言,得到多种技能,以及大数据的思维方式,何乐而不为呢。

-

Python有多火?

Python有多火?大多数IT研发岗位,都需要Python程序员;甚至许多非研发岗位,纷纷在JD中给出精通Python技能者优先的字样。

-

-

-

Python的学习曲线

对于爱好者来说, python上手非常容易,学习曲线非常平滑。基本的例子,几行代码都能完成。

-

python代码环境安装几乎是傻瓜式的,不像java要考虑众多库的配置和解决冲突。如果有编程的基础甚至只需要几小时就能上手,即使没有基础的小白,通过努力,7-10天,每天1小时,也可以快速掌握基本编程技巧。

-

Python的学习资料

Python官网
Python.org

-

廖雪峰的Python教程
https://www.liaoxuefeng.com/

-

简明python教程
http://www.kuqin.com/abyteofpython_cn/

-
-

重点推荐书籍:《Python 基础教程》

-

-

知乎评价:

-

其他入门书籍:

-
    -
  • Head First Python
  • -
  • Dive Into Python
  • -
  • Python 核心编程
  • -
  • 深入理解 Python
  • -
  • Python 标准库
  • -
  • Python 编程指南
  • -
-

(我们搜集了一些网上的电子书版本,关注公众号,回复”python”获取)

-

当然,英文著作虽然经典,但涉及领域众多,概念多,信息量大,不适合速成。网上的资料丰富,但也鱼龙混杂。

-

以 “Python入门” 为关键字搜索出的结果成千上万。不少小白选手难免会东一榔头西一棒槌,最终看了很多文章,却仍没跨过新手那道门槛。

-

我们这里有一个python的入门课程,帮你把需要掌握的python基础知识都融汇贯通在小篇幅中。我们提供了很多有趣的实践项目,并且可以进群,互助学习,遇到困难有人来解答。

-

加群请关注公众号,并回复“训练营”
flypython微信公众号

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-tutorial-02/index.html b/article/python-tutorial-02/index.html deleted file mode 100644 index 989e489..0000000 --- a/article/python-tutorial-02/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 潘石屹:我们为什么要学习Python语言? | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

潘石屹:我们为什么要学习Python语言?

-
- Author:flypython | Date: 2019-02-02 | Category:Python入门 -
-
-
-
-
-
-

11 月 15 日,SOHO 中国董事长潘石屹在微博上宣布,开始学习一门新的语言 Python,这也是今天给自己人生的礼物。

-
-

-

什么鬼?房地产大佬要学python?

-

-

潘石屹,一位成功的房地产开发商老板,第一专业是石油方面的,63年出生,年龄都超过了55岁,这些描述怎么着都和编程沾不上边啊。然而,最近他非常高调地表示,要学习一款编程语言。
虽然我不同意他的有些观点,不过他的跨界,不给自己设限的态度是还是值得学习的。
大佬都忙着学编程,这让我们35岁左右的专业程序员们非常惭愧啊(难道非得财务自由以后才能学python么)。

-

-

潘石屹学python肯定不是为了转行找工作,肯定也不是为了爬取全网美女图片,他在微博里详细阐述了我们为什么要学习Python语言。

-

-

我们为什么要学习python——使用范围广
01.数据分析

-

对于数据科学和机器学习,Python是首选编程语言。python有众多数据分析工具,知名数据分析比赛网站kaggle,90%以上的竞赛代码都是用python写成。大数据平台如hadoop、spark、flink、beam,python有完整的支持api可调用。

-

02.网站开发

-

对于网站开发,Python的生态环境也可以支撑起重量级的产品。国外的Youtube,Instagram,Pinterest,Reddit,Dropbox,Disqus, Quora等知名应用一开始都是基于Python构建,国内的豆瓣,知乎,果壳,饿了么,等初期在也是Python应用的典型。

-

03.爬虫

-

对于爬虫,则想不到比python更方便、更通用的的语言了。Python极其丰富的生态,诸如Request、Beautiful Soup、Scrapy、PySpider等第三方库,加上简洁易上手的语法,分分钟就能让你写出一个爬虫来。

-

此外,还有机器学习、人工智能、科学计算、IT运维等领域,Python都是极其方便顺手的工具,更重要的是,永远开源,免费。

-

Python的就业前景
在it行业飞速发展的今天,在数据成为it命脉的时代,python的重要意义越来越不言自明。学习python,不仅仅是一门可以调用数据结构和算法的语言,在学会python的同时,可以同时学会爬取互联网海量资源,学会自动化分析互联网海量数据,学会制作展示宣传的网站,学会使用人工智能预测和改变世界。学习一门语言,得到多种技能,以及大数据的思维方式,何乐而不为呢。

-

Python有多火?大多数IT研发岗位,都需要Python程序员;甚至许多非研发岗位,纷纷在JD中给出精通Python技能者优先的字样。

-

Python的学习曲线
对于爱好者来说, python上手非常容易,学习曲线非常平滑。基本的例子,几行代码都能完成。python代码环境安装几乎是傻瓜式的,不像java要考虑众多库的配置和解决冲突。如果有编程的基础甚至只需要几小时就能上手,即使没有基础的小白,通过努力,7-10天,每天1小时,也可以快速掌握基本编程技巧。

-

Python的学习资料

-

Python官网

-

Python.org

-

廖雪峰的Python教程

-

https://www.liaoxuefeng.com/

-

简明的python教程

-

http://www.kuqin.com/abyteofpython_cn/

-

重点推荐书籍:

-

《Python 基础教程》

-

知乎评价:

-

其他入门书籍:

-

Head First Python

-

Dive Into Python

-

Python 核心编程

-

深入理解 Python

-

Python 标准库

-

Python 编程指南

-

(我们搜集了一些网上的电子书版本,关注公众号,回复”python”获取)

-

当然,英文著作虽然经典,但涉及领域众多,概念多,信息量大,不适合速成。网上的资料丰富,但也鱼龙混杂。

-

以 “Python入门” 为关键字搜索出的结果成千上万。不少小白选手难免会东一榔头西一棒槌,最终看了很多文章,却仍没跨过新手那道门槛。

-

我们这里有一个python的入门课程,帮你把需要掌握的python基础知识都融汇贯通在小篇幅中。我们提供了很多有趣的实践项目,并且可以进群,互助学习,遇到困难有人来解答。

-

加群请加个人微信号flypython。

-

人生苦短,我用python早下班。如果觉得不错,对你工作中有帮助,动动手指分享给更多人哦。

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/article/python-tutorial-03/index.html b/article/python-tutorial-03/index.html deleted file mode 100644 index 3da5131..0000000 --- a/article/python-tutorial-03/index.html +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Python正则15分钟入门 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
-
-
-

Python正则15分钟入门

-
- Author:flypython | Date: 2019-02-03 | Category:Python入门 -
-
-
-
-
-

flypython群里有同学问我,如何从大量格式不确定的word文档抽取姓名、电话号码、邮箱等信息存入excel表格。通过之前我们的文章,他已经学会读取和写入文档和表格,但就是无法处理格式不确定的文档。这里介绍的正则方法,可以帮助他解决这个问题。

-

目标

15分钟内让你真正明白正则表达式是什么,并且让你可以在自己的python程序里正确使用它。

-

你将学会:

-
    -
  1. 极简python使用正则的方法
  2. -
  3. 如果利用python高效的匹配字符串
  4. -
  5. 如何利用python正则进行文本判断、过滤、信息提取
  6. -
-

0.极简正则入门

假设程序从word或者excel读取了一串字符串,字符串中有一部分是电话号码,现在需要完整提取这个电话号码。

-
1
2
3
4
import re
reg=re.compile("[0-9]+")
a=reg.findall("我的电话是3555487")
print(a)
- -

输出:

-

-

解释:
"[0-9]+"是正则表达式,意思是匹配0-9的数字,"+"
表示可以匹配1次-多次,reg.findall表示从后面的字符串里找到所有的匹配值。

-

1.字符集

字符集,又叫元字符,就是用一些特殊符号表示特定种类的字符或位置。

-

匹配字符

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
代码说明
.匹配除换行符以外的任意一个字符
\d匹配数字
\w匹配字母或数字或下划线或汉字
\s匹配任意的空白符
^匹配字符串的开始
$匹配字符串的结束
-

举例

-
1
2
3
4
import re
reg=re.compile("我.")
a=reg.findall("我的电话是3555487")
print(a)
- -

输出:

-

重复匹配

- - - - - - - - - - - - - - - - - - - - - - - - - - -
代码说明
*重复0次-无数次
+重复1次-无数次
?重复0次-1次
{m}重复m次
{m,n}重复m-n次
-

举例

-
1
2
3
4
import re
reg=re.compile("5+")
a=reg.findall("我的电话是3555487")
print(a)
- -

输出:

-

贪婪与懒惰

贪婪:匹配尽可能长的字符串
懒惰:匹配尽可能短的字符串
懒惰模式的启用只需在重复元字符之后加?既可。

-
    -
  • *? 重复任意次,但尽可能少重复
  • -
  • +? 重复1次或更多次,但尽可能少重复
  • -
  • ?? 重复0次或1次,但尽可能少重复
  • -
  • {n,m}? 重复n到m次,但尽可能少重复
  • -
  • {n,}? 重复n次以上,但尽可能少重复
  • -
-

举例

-
1
2
3
4
import re
reg=re.compile("5+?")
a=reg.findall("我的电话是3555487")
print(a)
- -

输出

-

注意:
如果想匹配元字符本身或者正则中的一些特殊字符,使用\\转义。

-

这里介绍的正则内容是最基础的,想要了解更详细的正则表达式语法,请参考:

-

2.利用正则判断

判断

有时候我们想利用正则表达式对用户输入进行判断,比如判断用户输入的身份证号是否符合规则,那么可以这样写:

-
1
2
3
4
5
6
7
8
9
10
11
import re
r=r'^([1-9]\d{5}[12]\d{3}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])\d{3}[0-9xX])$'

s1 = '110102200101014779'

#判断s1字符串是符合正则r
an = re.search(r, s1)
if an:
print ('yes')
else:
print ('no')
- -

输入结果

-

说明:^字符表示必须匹配字符串开头;$表示必须匹配字符串结尾。

-

过滤

假设,输出一串文本,只想保留汉字,去除特殊符号。代码如下:

-
1
2
3
4
5
import re
special_character_removal = re.compile(r'[,。、【 】“”:;()《》‘’{}?!⑦%>℃.^-——=&#@¥『』]', re.IGNORECASE)
line="贾蓉看了说:“高明的很。还要请教先生,这病与『性』命终久有妨无妨?”"
l = special_character_removal.sub('', line)
print(l)
- -

输入结果:

-

查找位置

查找某个文本在字符串中的位置,一般用于信息提取。

-
1
2
3
4
5
6
7
8
import re
p = re.compile("\d+")
content="2019年9月9月9日"
result2 = p.finditer(content)

for m in result2:
print("str",m.group()) ##字符串
print("start: ",m.start()," end: ",m.end()) ##字符串位置
- -

输出结果

-

-

人生苦短,我用python早下班。如果觉得不错,对你工作中有帮助,请长按下面二维码关注我们。(回复训练营加群,一起探讨python问题)

-

flypython微信公众号

- -
-
-
- -
- - - - -
- -
- - - - diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..5abc313 --- /dev/null +++ b/config.toml @@ -0,0 +1,45 @@ +baseURL = "https://flypython.com" +languageCode = "en-us" +title = "flyptthon" +disableKinds = ["sitemap", "RSS"] +theme = "reveal-hugo" +# theme = "." +# themesDir = "../" + +# uncomment for browsing at file:/// +# relativeURLs = true +# uglyURLs = true + +[author] +name = "Josh Dzielak" + +# currently only the unsafe mode for goldmark is supported +[markup.goldmark.renderer] +unsafe = true + +# choose between Hugo compile-time or Highlight.js +# syntax highlighting for code inside of code fences +[markup.highlight] +codeFences = false # use highlight.js +# codeFences = true # use hugo highlighting at compile time +style = "tango" # set a style for hugo highlighting + +[outputFormats.Reveal] +baseName = "index" +mediaType = "text/html" +isHTML = true + +[params.reveal_hugo] +history = true + +# used in content/template-example +[params.reveal_hugo.templates.grey] +background = "#424242" +transition = "convex" + + + +[module] + # needs hugo v0.109.0 or higher and go 1.18 or higher: + # uncomment line below for local development of module + # workspace = "hugo.work" \ No newline at end of file diff --git a/content/_index.md b/content/_index.md new file mode 100644 index 0000000..7b31b77 --- /dev/null +++ b/content/_index.md @@ -0,0 +1,56 @@ ++++ +title = "flypython" +outputs = ["Reveal"] + +[logo] +src = "flypython.png" +alt = "flypython" # Alt text. +width = "15%" # Size of the file. +diag = "10%" # How far from the top right should the file be. +top = "5%" # Overrides diag. +right = "20%" # Overrides diag. + +[reveal_hugo] +custom_theme = "reveal-hugo/themes/robot-lung.css" +margin = 0.25 ++++ + +## Fly-Python + +Welcome to FlyPython + +A community for learning Python through LLM driven by interesting projects. + +Here, we focus on teaching projects related to LLM using Python, aiming to reduce the obstacles you may encounter while exploring AI. + +Help you more quickly adopt AI in your life and work. + + +--- + +Welcome to subscribe to our Newsletter. + +[👉 FlyPython Newsletter](https://blog.flypython.com/) + + +--- +💡 Tip: + +By becoming a paid member, you will receive more of the latest in-depth articles on LLM, and at the same time, you will be supporting our sustained efforts in this area. + + +--- + +# 🤗 + +That's it. + +We will be updating soon, please stay tuned. + + +[Newsletter](https://blog.flypython.com/) + + + + + diff --git a/images/flypython.png b/content/flypython.png similarity index 100% rename from images/flypython.png rename to content/flypython.png diff --git a/css/f25.css b/css/f25.css deleted file mode 100644 index d9c919b..0000000 --- a/css/f25.css +++ /dev/null @@ -1,503 +0,0 @@ -body{ - margin: 0; - font-family: "PingFang SC","Lantinghei SC","Microsoft Yahei","Hiragino Sans GB","Microsoft Sans Serif","WenQuanYi Micro Hei",sans; - -webkit-font-smoothing: antialiased; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; - text-rendering: optimizelegibility; - -webkit-overflow-scrolling: touch; - overflow: scroll; -} -html , body{ - height: 100%; -} -.header-wrapper{ - height: 64px; - width: 100%; - position: fixed; - top: 0; - left: 0; - z-index: 999; - background: #fff; - box-shadow: 0px 1px 2px #999; -} -.wrapper{ - width: 100%; -} -.wrapper::before, -.wrapper::after{ - clear: both; - display: table; - content: ""; -} -.container{ - width: 1200px; - margin: 0 auto; -} -.sub-container{ - width: 960px; - margin: 0 auto; -} -.container::before, -.container::after, -.sub-container::before, -.sub-container::after{ - clear: both; - display: table; - content: ""; -} -.header-nav-wrapper{ - height: 100%; - position: relative; -} - -.logo{ - float: left; - height: 100%; - width: 200px; - background: #fff; -} -.logo a{ - width: 100%; - height: 100%; - color: #03339e; - text-decoration: none; -} -.logo a:hover, -.logo a:visited, -.logo a:acive{ - color: #03339e; - text-decoration: none; -} -.logo .title{ - margin: 0; - padding: 0; - line-height: 64px; - user-select: none; - width: 100%; - height: 100%; - font-size: 24px; - box-sizing: border-box; -} -.nav-wrapper{ - float: right; -} -.nav-wrapper a{ - display: block; - float: left; - height: 100%; - font-size: 18px; - line-height: 20px; - padding: 22px; - color: #000; - cursor: pointer; - text-decoration: none; - transition: all .4s; -} -.nav-wrapper a:hover{ - color: #fff; - background-color: #6C62C7; - text-decoration: none; -} -.nav-wrapper a:active, -.nav-wrapper a:visited{ - text-decoration: none; -} -.body-wrapper{ - min-height: 100%; - box-sizing: border-box; - padding: 64px 0 60px 0; - position: relative; -} -.banner-wrapper{ - height: 250px; - background: url(/images/bg_sm.png) repeat; - background-color: #000; -} -.banner-container{ - height: 100%; - background: url(/images/bg.png) no-repeat; - background-position: center; - background-size: auto 100%; -} -.menu-wrapper{ - margin-top: 20px; -} -.menu-wrapper a{ - text-decoration: none; - color: #333; - font-size: 16px; - box-sizing: border-box; - font-weight: 600; - padding: 10px 20px; - float: left; - transition: all .4s; - margin-right: 10px; - -} -.menu-wrapper a:lash-child{ - margin-right: 0; -} -.menu-wrapper a.active, -.menu-wrapper a:hover{ - text-decoration: none; - color: #fff; - background-color: #6C62C7; -} -.list-container{ - padding: 0; -} -.post-i-wrapper{ - list-style: none; - width: 280px; - height: 240px; - float: left; - margin: 26px 26px 26px 0; - background-color: #fff; - cursor: pointer; - box-shadow: 0px 2px 6px #ccc; - transition: all .2s; -} -.post-i-wrapper .post-i-link{ - width: 100%; - height: 100%; - text-decoration: none; -} -.post-i-wrapper:hover{ - box-shadow: 0px 0px 10px #000; -} -.post-i-wrapper .cover{ - width: 100%; - height: 113px; - overflow: hidden; -} -.post-i-wrapper .cover img{ - width: 100%; - min-height: 100%; -} -.post-i-wrapper .title{ - margin: 0; - font-size: 18px; - font-weight: 400; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - box-sizing: border-box; - padding: 20px 10px 10px 10px; - color: #000; -} -.post-i-wrapper .subtitle{ - line-height: 22px; - text-indent: 28px; - font-size: 14px; - font-weight: 400; - max-height: 44px; - overflow: hidden; - box-sizing: border-box; - padding: 0 10px; - color: #666; - margin: 0; -} -.post-i-wrapper .time{ - color: #999; - font-size: 12px; - padding: 10px; - display: block; - box-sizing: border-box; - text-align: left; -} -.post-banner{ - height: 400px; - background-color: #6C62C7; -} -.post-banner-container{ - height: 100%; - background: url(/images/bg_post.png) no-repeat; - background-position: center; - background-size: 100% auto; -} -.post-banner-container .title{ - width: 100%; - text-align: center; - font-size: 28px; - line-height: 40px; - margin: 0; - margin-top: 160px; - font-weight: 500; - color: #fff; -} -.post-banner-container .tips { - text-align: center; - color: #D8D8F6; -} -.post-banner-container .tips a{ - color: #D8D8F6; - text-decoration: none; - transition: all .4s; -} -.post-banner-container .tips a:hover{ - color: #3A2BB4; - text-decoration: underline; -} -.post-content { - box-sizing: border-box; - padding: 20px 10px; - line-height: 1.8; -} -.post-content ul, -.post-content ol{ - box-sizing: border-box; - padding: 20px 10px; - margin: 0; -} -.post-content table{ - border-spacing: 0; - border-collapse: collapse; - -ms-word-break: break-all; - word-break: break-all; -} -.post-content table th{ - background: #eee; - padding: 4px; - border: 1px solid #999; -} -.post-content table td{ - border: 1px solid #999; - padding: 4px; -} -.post-content li{ - font-weight: 500; - line-height: 2; - color: #333; - -ms-word-break: break-all; - word-break: break-all; - list-style-position: inside; -} -.post-content p{ - -ms-word-break: break-all; - word-break: break-all; -} -.gitalk-wrapper{ - padding: 20px 10px; - box-sizing: border-box; -} -.footer-wrapper{ - width: 100%; - position: absolute; - bottom: 0; - left: 0; - height: 60px; - text-align: center; - background: #efefef; - box-sizing: border-box; - padding: 20px 0; - box-shadow: 0px 0px 2px #bbb; -} -.copyright{ - font-size: 14px; - vertical-align: middle; -} -.btn-menu { - display: none; - float: right; - width: 64px; - height: 64px; -} -.btn-menu .inner { - width: 100%; - height: 100%; - overflow: hidden; - position: relative; -} -.btn-menu .inner .line { - top: 30px; - left: 22px; - position: absolute; - width: 20px; - height: 3px; - -webkit-transition: all .5s; - transition: all .5s; - background: #000; -} -.btn-menu .inner .line-01 { - margin-top: -7px; -} -.btn-menu .inner .line-03 { - margin-top: 7px; -} -.btn-close .line-01 { - -webkit-transform: rotate(45deg) translate3d(5px, 5px, 0); - transform: rotate(45deg) translate3d(5px, 5px, 0); -} -.btn-close .line-03 { - -webkit-transform: rotate(-45deg) translate3d(5px, -5px, 0); - transform: rotate(-45deg) translate3d(5px, -5px, 0); -} -.btn-close .line-02 { - -webkit-transform: translate3d(50px, 0, 0); - transform: translate3d(50px, 0, 0); -} -.mb-nav-wrapper{ - position: absolute; - top: 64px; - z-index: 99; - background-color: #fff; - box-shadow: 0px 1px 2px #999; - display: none; -} -.mb-nav-wrapper.show{ - display: block; -} -.mb-nav-container a{ - display: block; - box-sizing: border-box; - padding: 10px; - line-height: 22px; - font-size: 14px; - text-decoration: none; - color: #000; - user-select: none; -} -.tips-top-wrapper{ - width: 40px; - height: 40px; - background: #d4d4d4; - margin-bottom: .5rem; - cursor: pointer; - transition: all .4s; - border-radius: 2px; - box-shadow: 2px 2px 2px #000; - position: fixed; - bottom: 20px; - right: 20px; - z-index: 99; -} -.tips-top-wrapper:hover{ - background: #000; - } -.tip-top-container{ - display: block; - width: 100%; - height: 100%; - text-align: center; - line-height: 48px; - position: relative; -} -.tip-top-container span{ - width: 2px; - height: 16px; - background: #fff; - display: block; - position: absolute; -} -.tip-top-container .l-bar{ - transform: rotateZ(45deg); - -ms-transform: rotateZ(45deg); - -webkit-transform: rotateZ(45deg); - left: 14px; - top: 12px; -} -.tip-top-container .r-bar{ - transform: rotateZ(-45deg); - -ms-transform: rotateZ(-45deg); - -webkit-transform: rotateZ(-45deg); - left: 25px; - top: 12px; -} -/****************************/ - -@media screen and (min-width: 901px) and (max-width: 1400px){ - .container, - .sub-container{ - width: 892px; - } - .post-i-wrapper{ - margin: 26px 26px 26px 0; - } - .post-i-wrapper:nth-child(3n){ - margin-right: 0; - } -} -@media screen and (min-width: 769px) and (max-width: 900px){ - .container, - .sub-container{ - width: 586px; - } - .post-i-wrapper{ - margin: 26px 26px 26px 0; - } - .post-i-wrapper:nth-child(2n){ - margin-right: 0; - } - .nav-wrapper a{ - padding: 22px 12px; - } - .menu-wrapper a{ - padding: 10px 8px; - } - .post-banner-container .title{ - font-size: 24px; - } -} -@media screen and (max-width: 768px){ - .container, - .sub-container{ - width: 100%; - } - .list-container{ - box-sizing: border-box; - padding: 10px 2px; - } - .post-i-wrapper{ - height: 320px; - width: 100%; - margin: 26px 0; - } - .post-i-wrapper .cover{ - height: 193px; - } - .logo .title{ - padding: 0 10px; - } - .nav-wrapper{ - display: none; - } - .logo{ - width: 140px; - } - .btn-menu{ - display: block; - } - .post-banner{ - height: 200px; - } - .post-banner-container .title{ - margin-top: 80px; - font-size: 18px; - line-height: 24px; - } - .post-banner-container .tips{ - font-size: 12px; - } - .post-content{ - font-size: 14px; - } - .menu-wrapper{ - box-sizing: border-box; - padding: 0 10px; - } - .menu-wrapper a{ - padding: 8px; - font-size: 14px; - } -} - -@media screen and ( min-width:1401px){ - .post-i-wrapper{ - margin: 26px 26px 26px 0; - } - .post-i-wrapper:nth-child(4n){ - margin-right: 0; - } -} - diff --git a/css/gitalk.css b/css/gitalk.css deleted file mode 100644 index 87acb21..0000000 --- a/css/gitalk.css +++ /dev/null @@ -1,1211 +0,0 @@ -@font-face { - font-family: octicons-link; - src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s04n6+7Vm1ozezUeLEaUjhaDSuXHwVRgvLJn1tQ7xiuVv/ocTRF42mNgZGBgYGbwZOBiAAFGJBIMAAizAFoAAABiAGIAznjaY2BkYGAA4in8zwXi+W2+MjCzMIDApSwvXzC97Z4Ig8N/BxYGZgcgl52BCSQKAA3jCV8CAABfAAAAAAQAAEB42mNgZGBg4f3vACQZQABIMjKgAmYAKEgBXgAAeNpjYGY6wTiBgZWBg2kmUxoDA4MPhGZMYzBi1AHygVLYQUCaawqDA4PChxhmh/8ODDEsvAwHgMKMIDnGL0x7gJQCAwMAJd4MFwAAAHjaY2BgYGaA4DAGRgYQkAHyGMF8NgYrIM3JIAGVYYDT+AEjAwuDFpBmA9KMDEwMCh9i/v8H8sH0/4dQc1iAmAkALaUKLgAAAHjaTY9LDsIgEIbtgqHUPpDi3gPoBVyRTmTddOmqTXThEXqrob2gQ1FjwpDvfwCBdmdXC5AVKFu3e5MfNFJ29KTQT48Ob9/lqYwOGZxeUelN2U2R6+cArgtCJpauW7UQBqnFkUsjAY/kOU1cP+DAgvxwn1chZDwUbd6CFimGXwzwF6tPbFIcjEl+vvmM/byA48e6tWrKArm4ZJlCbdsrxksL1AwWn/yBSJKpYbq8AXaaTb8AAHja28jAwOC00ZrBeQNDQOWO//sdBBgYGRiYWYAEELEwMTE4uzo5Zzo5b2BxdnFOcALxNjA6b2ByTswC8jYwg0VlNuoCTWAMqNzMzsoK1rEhNqByEyerg5PMJlYuVueETKcd/89uBpnpvIEVomeHLoMsAAe1Id4AAAAAAAB42oWQT07CQBTGv0JBhagk7HQzKxca2sJCE1hDt4QF+9JOS0nbaaYDCQfwCJ7Au3AHj+LO13FMmm6cl7785vven0kBjHCBhfpYuNa5Ph1c0e2Xu3jEvWG7UdPDLZ4N92nOm+EBXuAbHmIMSRMs+4aUEd4Nd3CHD8NdvOLTsA2GL8M9PODbcL+hD7C1xoaHeLJSEao0FEW14ckxC+TU8TxvsY6X0eLPmRhry2WVioLpkrbp84LLQPGI7c6sOiUzpWIWS5GzlSgUzzLBSikOPFTOXqly7rqx0Z1Q5BAIoZBSFihQYQOOBEdkCOgXTOHA07HAGjGWiIjaPZNW13/+lm6S9FT7rLHFJ6fQbkATOG1j2OFMucKJJsxIVfQORl+9Jyda6Sl1dUYhSCm1dyClfoeDve4qMYdLEbfqHf3O/AdDumsjAAB42mNgYoAAZQYjBmyAGYQZmdhL8zLdDEydARfoAqIAAAABAAMABwAKABMAB///AA8AAQAAAAAAAAAAAAAAAAABAAAAAA==) format('woff'); - } - - .markdown-body { - -ms-text-size-adjust: 100%; - -webkit-text-size-adjust: 100%; - line-height: 1.5; - color: #24292e; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; - font-size: 16px; - line-height: 1.5; - word-wrap: break-word; - } - - .markdown-body .pl-c { - color: #6a737d; - } - - .markdown-body .pl-c1, - .markdown-body .pl-s .pl-v { - color: #005cc5; - } - - .markdown-body .pl-e, - .markdown-body .pl-en { - color: #6f42c1; - } - - .markdown-body .pl-smi, - .markdown-body .pl-s .pl-s1 { - color: #24292e; - } - - .markdown-body .pl-ent { - color: #22863a; - } - - .markdown-body .pl-k { - color: #d73a49; - } - - .markdown-body .pl-s, - .markdown-body .pl-pds, - .markdown-body .pl-s .pl-pse .pl-s1, - .markdown-body .pl-sr, - .markdown-body .pl-sr .pl-cce, - .markdown-body .pl-sr .pl-sre, - .markdown-body .pl-sr .pl-sra { - color: #032f62; - } - - .markdown-body .pl-v, - .markdown-body .pl-smw { - color: #e36209; - } - - .markdown-body .pl-bu { - color: #b31d28; - } - - .markdown-body .pl-ii { - color: #fafbfc; - background-color: #b31d28; - } - - .markdown-body .pl-c2 { - color: #fafbfc; - background-color: #d73a49; - } - - .markdown-body .pl-c2::before { - content: "^M"; - } - - .markdown-body .pl-sr .pl-cce { - font-weight: bold; - color: #22863a; - } - - .markdown-body .pl-ml { - color: #735c0f; - } - - .markdown-body .pl-mh, - .markdown-body .pl-mh .pl-en, - .markdown-body .pl-ms { - font-weight: bold; - color: #005cc5; - } - - .markdown-body .pl-mi { - font-style: italic; - color: #24292e; - } - - .markdown-body .pl-mb { - font-weight: bold; - color: #24292e; - } - - .markdown-body .pl-md { - color: #b31d28; - background-color: #ffeef0; - } - - .markdown-body .pl-mi1 { - color: #22863a; - background-color: #f0fff4; - } - - .markdown-body .pl-mc { - color: #e36209; - background-color: #ffebda; - } - - .markdown-body .pl-mi2 { - color: #f6f8fa; - background-color: #005cc5; - } - - .markdown-body .pl-mdr { - font-weight: bold; - color: #6f42c1; - } - - .markdown-body .pl-ba { - color: #586069; - } - - .markdown-body .pl-sg { - color: #959da5; - } - - .markdown-body .pl-corl { - text-decoration: underline; - color: #032f62; - } - - .markdown-body .octicon { - display: inline-block; - vertical-align: text-top; - fill: currentColor; - } - - .markdown-body a { - background-color: transparent; - -webkit-text-decoration-skip: objects; - } - - .markdown-body a:active, - .markdown-body a:hover { - outline-width: 0; - } - - .markdown-body strong { - font-weight: inherit; - } - - .markdown-body strong { - font-weight: bolder; - } - - .markdown-body h1 { - font-size: 2em; - margin: 0.67em 0; - } - - .markdown-body img { - border-style: none; - } - - .markdown-body svg:not(:root) { - overflow: hidden; - } - - .markdown-body code, - .markdown-body kbd, - .markdown-body pre { - font-family: monospace, monospace; - font-size: 1em; - } - - .markdown-body hr { - -webkit-box-sizing: content-box; - box-sizing: content-box; - height: 0; - overflow: visible; - } - - .markdown-body input { - font: inherit; - margin: 0; - } - - .markdown-body input { - overflow: visible; - } - - .markdown-body [type="checkbox"] { - -webkit-box-sizing: border-box; - box-sizing: border-box; - padding: 0; - } - - .markdown-body * { - -webkit-box-sizing: border-box; - box-sizing: border-box; - } - - .markdown-body input { - font-family: inherit; - font-size: inherit; - line-height: inherit; - } - - .markdown-body a { - color: #0366d6; - text-decoration: none; - } - - .markdown-body a:hover { - text-decoration: underline; - } - - .markdown-body strong { - font-weight: 600; - } - - .markdown-body hr { - height: 0; - margin: 15px 0; - overflow: hidden; - background: transparent; - border: 0; - border-bottom: 1px solid #dfe2e5; - } - - .markdown-body hr::before { - display: table; - content: ""; - } - - .markdown-body hr::after { - display: table; - clear: both; - content: ""; - } - - .markdown-body table { - border-spacing: 0; - border-collapse: collapse; - } - - .markdown-body td, - .markdown-body th { - padding: 0; - } - - .markdown-body h1, - .markdown-body h2, - .markdown-body h3, - .markdown-body h4, - .markdown-body h5, - .markdown-body h6 { - margin-top: 0; - margin-bottom: 0; - } - - .markdown-body h1 { - font-size: 32px; - font-weight: 600; - } - - .markdown-body h2 { - font-size: 24px; - font-weight: 600; - } - - .markdown-body h3 { - font-size: 20px; - font-weight: 600; - } - - .markdown-body h4 { - font-size: 16px; - font-weight: 600; - } - - .markdown-body h5 { - font-size: 14px; - font-weight: 600; - } - - .markdown-body h6 { - font-size: 12px; - font-weight: 600; - } - - .markdown-body p { - margin-top: 0; - margin-bottom: 10px; - } - - .markdown-body blockquote { - margin: 0; - } - - .markdown-body ul, - .markdown-body ol { - padding-left: 0; - margin-top: 0; - margin-bottom: 0; - } - - .markdown-body ol ol, - .markdown-body ul ol { - list-style-type: lower-roman; - } - - .markdown-body ul ul ol, - .markdown-body ul ol ol, - .markdown-body ol ul ol, - .markdown-body ol ol ol { - list-style-type: lower-alpha; - } - - .markdown-body dd { - margin-left: 0; - } - - .markdown-body code { - font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; - font-size: 12px; - } - - .markdown-body pre { - margin-top: 0; - margin-bottom: 0; - font: 12px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; - } - - .markdown-body .octicon { - vertical-align: text-bottom; - } - - .markdown-body .pl-0 { - padding-left: 0 !important; - } - - .markdown-body .pl-1 { - padding-left: 4px !important; - } - - .markdown-body .pl-2 { - padding-left: 8px !important; - } - - .markdown-body .pl-3 { - padding-left: 16px !important; - } - - .markdown-body .pl-4 { - padding-left: 24px !important; - } - - .markdown-body .pl-5 { - padding-left: 32px !important; - } - - .markdown-body .pl-6 { - padding-left: 40px !important; - } - - .markdown-body::before { - display: table; - content: ""; - } - - .markdown-body::after { - display: table; - clear: both; - content: ""; - } - - .markdown-body>*:first-child { - margin-top: 0 !important; - } - - .markdown-body>*:last-child { - margin-bottom: 0 !important; - } - - .markdown-body a:not([href]) { - color: inherit; - text-decoration: none; - } - - .markdown-body .anchor { - float: left; - padding-right: 4px; - margin-left: -20px; - line-height: 1; - } - - .markdown-body .anchor:focus { - outline: none; - } - - .markdown-body p, - .markdown-body blockquote, - .markdown-body ul, - .markdown-body ol, - .markdown-body dl, - .markdown-body table, - .markdown-body pre { - margin-top: 0; - margin-bottom: 16px; - } - - .markdown-body hr { - height: 0.25em; - padding: 0; - margin: 24px 0; - background-color: #e1e4e8; - border: 0; - } - - .markdown-body blockquote { - padding: 0 1em; - color: #6a737d; - border-left: 0.25em solid #dfe2e5; - } - - .markdown-body blockquote>:first-child { - margin-top: 0; - } - - .markdown-body blockquote>:last-child { - margin-bottom: 0; - } - - .markdown-body kbd { - display: inline-block; - padding: 3px 5px; - font-size: 11px; - line-height: 10px; - color: #444d56; - vertical-align: middle; - background-color: #fafbfc; - border: solid 1px #c6cbd1; - border-bottom-color: #959da5; - border-radius: 3px; - -webkit-box-shadow: inset 0 -1px 0 #959da5; - box-shadow: inset 0 -1px 0 #959da5; - } - - .markdown-body h1, - .markdown-body h2, - .markdown-body h3, - .markdown-body h4, - .markdown-body h5, - .markdown-body h6 { - margin-top: 24px; - margin-bottom: 16px; - font-weight: 600; - line-height: 1.25; - } - - .markdown-body h1 .octicon-link, - .markdown-body h2 .octicon-link, - .markdown-body h3 .octicon-link, - .markdown-body h4 .octicon-link, - .markdown-body h5 .octicon-link, - .markdown-body h6 .octicon-link { - color: #1b1f23; - vertical-align: middle; - visibility: hidden; - } - - .markdown-body h1:hover .anchor, - .markdown-body h2:hover .anchor, - .markdown-body h3:hover .anchor, - .markdown-body h4:hover .anchor, - .markdown-body h5:hover .anchor, - .markdown-body h6:hover .anchor { - text-decoration: none; - } - - .markdown-body h1:hover .anchor .octicon-link, - .markdown-body h2:hover .anchor .octicon-link, - .markdown-body h3:hover .anchor .octicon-link, - .markdown-body h4:hover .anchor .octicon-link, - .markdown-body h5:hover .anchor .octicon-link, - .markdown-body h6:hover .anchor .octicon-link { - visibility: visible; - } - - .markdown-body h1 { - padding-bottom: 0.3em; - font-size: 2em; - border-bottom: 1px solid #eaecef; - } - - .markdown-body h2 { - padding-bottom: 0.3em; - font-size: 1.5em; - border-bottom: 1px solid #eaecef; - } - - .markdown-body h3 { - font-size: 1.25em; - } - - .markdown-body h4 { - font-size: 1em; - } - - .markdown-body h5 { - font-size: 0.875em; - } - - .markdown-body h6 { - font-size: 0.85em; - color: #6a737d; - } - - .markdown-body ul, - .markdown-body ol { - padding-left: 2em; - } - - .markdown-body ul ul, - .markdown-body ul ol, - .markdown-body ol ol, - .markdown-body ol ul { - margin-top: 0; - margin-bottom: 0; - } - - .markdown-body li>p { - margin-top: 16px; - } - - .markdown-body li+li { - margin-top: 0.25em; - } - - .markdown-body dl { - padding: 0; - } - - .markdown-body dl dt { - padding: 0; - margin-top: 16px; - font-size: 1em; - font-style: italic; - font-weight: 600; - } - - .markdown-body dl dd { - padding: 0 16px; - margin-bottom: 16px; - } - - .markdown-body table { - display: block; - width: 100%; - overflow: auto; - } - - .markdown-body table th { - font-weight: 600; - } - - .markdown-body table th, - .markdown-body table td { - padding: 6px 13px; - border: 1px solid #dfe2e5; - } - - .markdown-body table tr { - background-color: #fff; - border-top: 1px solid #c6cbd1; - } - - .markdown-body table tr:nth-child(2n) { - background-color: #f6f8fa; - } - - .markdown-body img { - max-width: 100%; - -webkit-box-sizing: content-box; - box-sizing: content-box; - background-color: #fff; - } - - .markdown-body code { - padding: 0; - padding-top: 0.2em; - padding-bottom: 0.2em; - margin: 0; - font-size: 85%; - background-color: rgba(27,31,35,0.05); - border-radius: 3px; - } - - .markdown-body code::before, - .markdown-body code::after { - letter-spacing: -0.2em; - content: "\A0"; - } - - .markdown-body pre { - word-wrap: normal; - } - - .markdown-body pre>code { - padding: 0; - margin: 0; - font-size: 100%; - word-break: normal; - white-space: pre; - background: transparent; - border: 0; - } - - .markdown-body .highlight { - margin-bottom: 16px; - } - - .markdown-body .highlight pre { - margin-bottom: 0; - word-break: normal; - } - - .markdown-body .highlight pre, - .markdown-body pre { - padding: 16px; - overflow: auto; - font-size: 85%; - line-height: 1.45; - background-color: #f6f8fa; - border-radius: 3px; - } - - .markdown-body pre code { - display: inline; - max-width: auto; - padding: 0; - margin: 0; - overflow: visible; - line-height: inherit; - word-wrap: normal; - background-color: transparent; - border: 0; - } - - .markdown-body pre code::before, - .markdown-body pre code::after { - content: normal; - } - - .markdown-body .full-commit .btn-outline:not(:disabled):hover { - color: #005cc5; - border-color: #005cc5; - } - - .markdown-body kbd { - display: inline-block; - padding: 3px 5px; - font: 11px "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; - line-height: 10px; - color: #444d56; - vertical-align: middle; - background-color: #fafbfc; - border: solid 1px #d1d5da; - border-bottom-color: #c6cbd1; - border-radius: 3px; - -webkit-box-shadow: inset 0 -1px 0 #c6cbd1; - box-shadow: inset 0 -1px 0 #c6cbd1; - } - - .markdown-body :checked+.radio-label { - position: relative; - z-index: 1; - border-color: #0366d6; - } - - .markdown-body .task-list-item { - list-style-type: none; - } - - .markdown-body .task-list-item+.task-list-item { - margin-top: 3px; - } - - .markdown-body .task-list-item input { - margin: 0 0.2em 0.25em -1.6em; - vertical-align: middle; - } - - .markdown-body hr { - border-bottom-color: #eee; - } - /* variables */ - /* functions & mixins */ - /* variables - calculated */ - /* styles */ - .gt-container { - -webkit-box-sizing: border-box; - box-sizing: border-box; - font-size: 16px; - /* loader */ - /* error */ - /* initing */ - /* no int */ - /* link */ - /* meta */ - /* popup */ - /* header */ - /* comments */ - /* comment */ - } - .gt-container * { - -webkit-box-sizing: border-box; - box-sizing: border-box; - } - .gt-container a { - color: #6190e8; - } - .gt-container a:hover { - color: #81a6ed; - border-color: #81a6ed; - } - .gt-container a.is--active { - color: #333; - cursor: default !important; - } - .gt-container a.is--active:hover { - color: #333; - } - .gt-container .hide { - display: none !important; - } - .gt-container .gt-svg { - display: inline-block; - width: 1em; - height: 1em; - vertical-align: sub; - } - .gt-container .gt-svg svg { - width: 100%; - height: 100%; - fill: #6190e8; - } - .gt-container .gt-ico { - display: inline-block; - } - .gt-container .gt-ico-text { - margin-left: 0.3125em; - } - .gt-container .gt-ico-github { - width: 100%; - height: 100%; - } - .gt-container .gt-ico-github .gt-svg { - width: 100%; - height: 100%; - } - .gt-container .gt-ico-github svg { - fill: inherit; - } - .gt-container .gt-spinner { - position: relative; - } - .gt-container .gt-spinner::before { - content: ''; - -webkit-box-sizing: border-box; - box-sizing: border-box; - position: absolute; - top: 3px; - width: 0.75em; - height: 0.75em; - margin-top: -0.1875em; - margin-left: -0.375em; - border-radius: 50%; - border: 1px solid #fff; - border-top-color: #6190e8; - -webkit-animation: gt-kf-rotate 0.6s linear infinite; - animation: gt-kf-rotate 0.6s linear infinite; - } - .gt-container .gt-loader { - position: relative; - border: 1px solid #999; - -webkit-animation: ease gt-kf-rotate 1.5s infinite; - animation: ease gt-kf-rotate 1.5s infinite; - display: inline-block; - font-style: normal; - width: 1.75em; - height: 1.75em; - line-height: 1.75em; - border-radius: 50%; - } - .gt-container .gt-loader:before { - content: ''; - position: absolute; - display: block; - top: 0; - left: 50%; - margin-top: -0.1875em; - margin-left: -0.1875em; - width: 0.375em; - height: 0.375em; - background-color: #999; - border-radius: 50%; - } - .gt-container .gt-avatar { - display: inline-block; - width: 3.125em; - height: 3.125em; - } - @media (max-width: 479px) { - .gt-container .gt-avatar { - width: 2em; - height: 2em; - } - } - .gt-container .gt-avatar img { - width: 100%; - height: auto; - border-radius: 3px; - } - .gt-container .gt-avatar-github { - width: 3em; - height: 3em; - } - @media (max-width: 479px) { - .gt-container .gt-avatar-github { - width: 1.875em; - height: 1.875em; - } - } - .gt-container .gt-btn { - padding: 0.75em 1.25em; - display: inline-block; - line-height: 1; - text-decoration: none; - white-space: nowrap; - cursor: pointer; - border: 1px solid #6190e8; - border-radius: 5px; - background-color: #6190e8; - color: #fff; - outline: none; - font-size: 0.75em; - } - .gt-container .gt-btn-text { - font-weight: 400; - } - .gt-container .gt-btn-loading { - position: relative; - margin-left: 0.5em; - display: inline-block; - width: 0.75em; - height: 1em; - vertical-align: top; - } - .gt-container .gt-btn.is--disable { - cursor: not-allowed; - opacity: 0.5; - } - .gt-container .gt-btn-login { - margin-right: 0; - } - .gt-container .gt-btn-preview { - background-color: #fff; - color: #6190e8; - } - .gt-container .gt-btn-preview:hover { - background-color: #f2f2f2; - border-color: #81a6ed; - } - .gt-container .gt-btn-public:hover { - background-color: #81a6ed; - border-color: #81a6ed; - } - .gt-container .gt-error { - text-align: center; - margin: 0.625em; - color: #ff3860; - } - .gt-container .gt-initing { - padding: 1.25em 0; - text-align: center; - } - .gt-container .gt-initing-text { - margin: 0.625em auto; - font-size: 92%; - } - .gt-container .gt-no-init { - padding: 1.25em 0; - text-align: center; - } - .gt-container .gt-link { - border-bottom: 1px dotted #6190e8; - } - .gt-container .gt-link-counts, - .gt-container .gt-link-project { - text-decoration: none; - } - .gt-container .gt-meta { - margin: 1.25em 0; - padding: 1em 0; - position: relative; - border-bottom: 1px solid #e9e9e9; - font-size: 1em; - position: relative; - z-index: 10; - } - .gt-container .gt-meta:before, - .gt-container .gt-meta:after { - content: " "; - display: table; - } - .gt-container .gt-meta:after { - clear: both; - } - .gt-container .gt-counts { - margin: 0 0.625em 0 0; - } - .gt-container .gt-user { - float: right; - margin: 0; - font-size: 92%; - } - .gt-container .gt-user-pic { - width: 16px; - height: 16px; - vertical-align: top; - margin-right: 0.5em; - } - .gt-container .gt-user-inner { - display: inline-block; - cursor: pointer; - } - .gt-container .gt-user .gt-ico { - margin: 0 0 0 0.3125em; - } - .gt-container .gt-user .gt-ico svg { - fill: inherit; - } - .gt-container .gt-user .is--poping .gt-ico svg { - fill: #6190e8; - } - .gt-container .gt-version { - color: #a1a1a1; - margin-left: 0.375em; - } - .gt-container .gt-copyright { - margin: 0 0.9375em 0.5em; - border-top: 1px solid #e9e9e9; - padding-top: 0.5em; - } - .gt-container .gt-popup { - position: absolute; - right: 0; - top: 2.375em; - background: #fff; - display: inline-block; - border: 1px solid #e9e9e9; - padding: 0.625em 0; - font-size: 0.875em; - letter-spacing: 0.5px; - } - .gt-container .gt-popup .gt-action { - cursor: pointer; - display: block; - margin: 0.5em 0; - padding: 0 1.125em; - position: relative; - text-decoration: none; - } - .gt-container .gt-popup .gt-action.is--active:before { - content: ''; - width: 0.25em; - height: 0.25em; - background: #6190e8; - position: absolute; - left: 0.5em; - top: 0.4375em; - } - .gt-container .gt-header { - position: relative; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - } - .gt-container .gt-header-comment { - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1; - margin-left: 1.25em; - } - @media (max-width: 479px) { - .gt-container .gt-header-comment { - margin-left: 0.875em; - } - } - .gt-container .gt-header-textarea { - padding: 0.75em; - display: block; - -webkit-box-sizing: border-box; - box-sizing: border-box; - width: 100%; - min-height: 5.125em; - max-height: 15em; - border-radius: 5px; - border: 1px solid rgba(0,0,0,0.1); - font-size: 0.875em; - word-wrap: break-word; - resize: vertical; - background-color: #f6f6f6; - outline: none; - -webkit-transition: all 0.25s ease; - transition: all 0.25s ease; - } - .gt-container .gt-header-textarea:hover { - background-color: #fbfbfb; - } - .gt-container .gt-header-preview { - padding: 0.75em; - border-radius: 5px; - border: 1px solid rgba(0,0,0,0.1); - background-color: #f6f6f6; - } - .gt-container .gt-header-controls { - position: relative; - margin: 0.75em 0 0; - } - .gt-container .gt-header-controls:before, - .gt-container .gt-header-controls:after { - content: " "; - display: table; - } - .gt-container .gt-header-controls:after { - clear: both; - } - @media (max-width: 479px) { - .gt-container .gt-header-controls { - margin: 0; - } - } - .gt-container .gt-header-controls-tip { - font-size: 0.875em; - color: #6190e8; - text-decoration: none; - vertical-align: sub; - } - @media (max-width: 479px) { - .gt-container .gt-header-controls-tip { - display: none; - } - } - .gt-container .gt-header-controls .gt-btn { - float: right; - margin-left: 1.25em; - } - @media (max-width: 479px) { - .gt-container .gt-header-controls .gt-btn { - float: none; - width: 100%; - margin: 0.75em 0 0; - } - } - .gt-container:after { - content: ''; - position: fixed; - bottom: 100%; - left: 0; - right: 0; - top: 0; - opacity: 0; - } - .gt-container.gt-input-focused { - position: relative; - } - .gt-container.gt-input-focused:after { - content: ''; - position: fixed; - bottom: 0%; - left: 0; - right: 0; - top: 0; - background: #000; - opacity: 0.6; - -webkit-transition: opacity 0.3s, bottom 0s; - transition: opacity 0.3s, bottom 0s; - z-index: 9999; - } - .gt-container.gt-input-focused .gt-header-comment { - z-index: 10000; - } - .gt-container .gt-comments { - padding-top: 1.25em; - } - .gt-container .gt-comments-null { - text-align: center; - } - .gt-container .gt-comments-controls { - margin: 1.25em 0; - text-align: center; - } - .gt-container .gt-comment { - position: relative; - padding: 0.625em 0; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - } - .gt-container .gt-comment-content { - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1; - margin-left: 1.25em; - padding: 0.75em 1em; - background-color: #f9f9f9; - overflow: auto; - -webkit-transition: all ease 0.25s; - transition: all ease 0.25s; - } - .gt-container .gt-comment-content:hover { - -webkit-box-shadow: 0 0.625em 3.75em 0 #f4f4f4; - box-shadow: 0 0.625em 3.75em 0 #f4f4f4; - } - @media (max-width: 479px) { - .gt-container .gt-comment-content { - margin-left: 0.875em; - padding: 0.625em 0.75em; - } - } - .gt-container .gt-comment-header { - margin-bottom: 0.5em; - font-size: 0.875em; - position: relative; - } - .gt-container .gt-comment-username { - font-weight: 500; - color: #6190e8; - text-decoration: none; - } - .gt-container .gt-comment-username:hover { - text-decoration: underline; - } - .gt-container .gt-comment-text { - margin-left: 0.5em; - color: #a1a1a1; - } - .gt-container .gt-comment-date { - margin-left: 0.5em; - color: #a1a1a1; - } - .gt-container .gt-comment-like, - .gt-container .gt-comment-edit, - .gt-container .gt-comment-reply { - position: absolute; - height: 1.375em; - } - .gt-container .gt-comment-like:hover, - .gt-container .gt-comment-edit:hover, - .gt-container .gt-comment-reply:hover { - cursor: pointer; - } - .gt-container .gt-comment-like { - top: 0; - right: 2em; - } - .gt-container .gt-comment-edit, - .gt-container .gt-comment-reply { - top: 0; - right: 0; - } - .gt-container .gt-comment-body { - color: #333 !important; - } - .gt-container .gt-comment-admin .gt-comment-content { - background-color: #f6f9fe; - } - @-webkit-keyframes gt-kf-rotate { - 0% { - -webkit-transform: rotate(0); - transform: rotate(0); - } - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } - } - @keyframes gt-kf-rotate { - 0% { - -webkit-transform: rotate(0); - transform: rotate(0); - } - 100% { - -webkit-transform: rotate(360deg); - transform: rotate(360deg); - } - } - - /*# sourceMappingURL=gitalk.css.map*/ \ No newline at end of file diff --git a/css/highlight.css b/css/highlight.css deleted file mode 100644 index 37e1cc2..0000000 --- a/css/highlight.css +++ /dev/null @@ -1,446 +0,0 @@ -html { - -ms-text-size-adjust: 100%; -} - -article, aside, footer, header, nav, section { - display: block; -} - -figcaption, figure, main { - display: block; -} - -figure { - margin: 1em 40px; -} - -hr { - overflow: visible; -} - -a { - background-color: transparent; - -webkit-text-decoration-skip: object; -} - -mark { - background-color: #ff0; - color: #000; -} - -audio, video { - display: inline-block; -} - -img { - border-style: none; - max-width: 100%; -} - -svg:not(:root) { - overflow: hidden; -} - -button, input { - overflow: visible; -} - -button, select { - text-transform: none; -} - -legend { - box-sizing: border-box; - color: inherit; - display: table; - max-width: 100%; - white-space: normal; -} - -progress { - display: inline-block; -} -blockquote{ - background: #ecf0f1; - margin: 0; - padding: 2px 10px; - font-style: italic; - box-sizing: border-box; -} -textarea { - overflow: auto; -} - -[type="checkbox"], [type="radio"] { - box-sizing: border-box; - padding: 0; -} - -details, menu { - display: list-item; -} - -canvas { - display: inline-block; -} - -[type="search"]::-webkit-search-cancel-button, [type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -button, input, optgroup, select, textarea { - -webkit-appearance: none; - -webkit-tap-highlight-color: transparent; -} - -a { - -webkit-tap-highlight-color: transparent; -} - -/** - * Correct the style in all browsers. - */ -html { - font-family: "Helvetica Neue", Helvetica, STHeiTi, "Microsoft Yahei", sans-serif; - line-height: 1.15; - -webkit-text-size-adjust: 100%; -} - -body { - margin: 0; -} - -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -hr { - box-sizing: content-box; - height: 0; -} - -pre { - overflow: scroll; - font-family: monospace, monospace; - font-size: 1em; -} - -a:active, a:hover { - outline-width: 0; -} - -abbr[title] { - border-bottom: none; - text-decoration: underline; - text-decoration: underline dotted; -} - -b, strong { - font-weight: bolder; -} - -code, kbd, samp { - font-family: monospace, monospace; - font-size: 1em; -} - -dfn { - font-style: italic; -} - -small { - font-size: 80%; -} - -sub, sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sub { - bottom: -0.25em; -} - -sup { - top: -0.5em; -} - -audio:not([controls]) { - display: none; - height: 0; -} - -button, input, optgroup, select, textarea { - font-family: sans-serif; - font-size: 100%; - line-height: 1.15; - margin: 0; -} - -button, html [type="button"], [type="reset"], [type="submit"] { - -webkit-appearance: button; -} - -button::-moz-focus-inner, [type="button"]::-moz-focus-inner, [type="reset"]::-moz-focus-inner, [type="submit"]::-moz-focus-inner { - border-style: none; - padding: 0; -} - -button:-moz-focusring, [type="button"]:-moz-focusring, [type="reset"]:-moz-focusring, [type="submit"]:-moz-focusring { - outline: 1px dotted ButtonText; -} - -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} - -legend { - padding: 0; -} - -progress { - vertical-align: baseline; -} - -[type="number"]::-webkit-inner-spin-button, [type="number"]::-webkit-outer-spin-button { - height: auto; -} - -[type="search"] { - -webkit-appearance: textfield; - outline-offset: -2px; -} - -::-webkit-file-upload-button { - -webkit-appearance: button; - font: inherit; -} - -details, summary { - display: list-item; -} - -code, -pre { - font-size: 0.8em; - background-color: #ecf0f1; - font-family: 'Roboto Mono', Monaco, courier, monospace; -} - -code { - padding: 0.1em 0.4em; - background-color: #ecf0f1; - border-radius: 3px; -} - -pre .line { - min-height: 1em; -} - -.highlight { - position: relative; - margin: 1em 0; - border-radius: 2px; - line-height: 1.1em; - background-color: #ecf0f1; - overflow-x: auto; - -webkit-overflow-scrolling: touch; -} -.highlight figcaption { - font-size: .9em; - padding: .4em; - border-bottom: 1px solid #bdc3c7; -} -.highlight table, .highlight tr, .highlight td { - width: 100%; - border-collapse: collapse; - padding: 0; - margin: 0; -} -.highlight .gutter { - display: none; -} -.highlight .code pre { - padding: 1.2em 1.4em; - line-height: 1.5em; - margin: 0; -} - -.highlight.html .code:after, .highlight.js .code:after, .highlight.bash .code:after, .highlight.css .code:after, .highlight.scss .code:after, .highlight.diff .code:after, .highlight.java .code:after, .highlight.xml .code:after, .highlight.python .code:after, .highlight.json .code:after, .highlight.swift .code:after, .highlight.ruby .code:after, .highlight.perl .code:after, .highlight.php .code:after, .highlight.c .code:after, .highlight.cpp .code:after, .highlight.ts .code:after { - position: absolute; - top: 0; - right: 0; - color: #bdc3c7; - text-align: right; - font-size: 0.75em; - padding: 5px 10px 0; - line-height: 15px; - height: 15px; - font-weight: 600; -} - -.highlight.html .code:after { - content: "HTML"; -} - -.highlight.js .code:after { - content: "JS"; -} - -.highlight.bash .code:after { - content: "BASH"; -} - -.highlight.css .code:after { - content: "CSS"; -} - -.highlight.scss .code:after { - content: "SCSS"; -} - -.highlight.diff .code:after { - content: "DIFF"; -} - -.highlight.java .code:after { - content: "JAVA"; -} - -.highlight.xml .code:after { - content: "XML"; -} - -.highlight.python .code:after { - content: "PYTHON"; -} - -.highlight.json .code:after { - content: "JSON"; -} - -.highlight.swift .code:after { - content: "SWIFT"; -} - -.highlight.ruby .code:after { - content: "RUBY"; -} - -.highlight.perl .code:after { - content: "PERL"; -} - -.highlight.php .code:after { - content: "PHP"; -} - -.highlight.c .code:after { - content: "C"; -} - -.highlight.java .code:after { - content: "JAVA"; -} - -.highlight.cpp .code:after { - content: "CPP"; -} - -.highlight.ts .code:after { - content: "TS"; -} - -.highlight.cpp .code:after { - content: 'C++'; -} - -pre { - color: #34495e; -} -pre .function .keyword, -pre .constant { - color: #3498db; -} -pre .keyword, -pre .attribute { - color: #e96900; -} -pre .number, -pre .literal { - color: #8e44ad; -} -pre .tag, -pre .tag .title, -pre .change, -pre .winutils, -pre .flow, -pre .lisp .title, -pre .clojure .built_in, -pre .nginx .title, -pre .tex .special { - color: #2980b9; -} -pre .symbol, -pre .symbol .string, -pre .value, -pre .regexp { - color: #1abc9c; -} -pre .title { - color: #2ecc71; -} -pre .tag .value, -pre .string, -pre .subst, -pre .haskell .type, -pre .preprocessor, -pre .ruby .class .parent, -pre .built_in, -pre .sql .aggregate, -pre .django .template_tag, -pre .django .variable, -pre .smalltalk .class, -pre .javadoc, -pre .django .filter .argument, -pre .smalltalk .localvars, -pre .smalltalk .array, -pre .attr_selector, -pre .pseudo, -pre .addition, -pre .stream, -pre .envvar, -pre .apache .tag, -pre .apache .cbracket, -pre .tex .command, -pre .prompt { - color: #1abc9c; -} -pre .comment, -pre .java .annotation, -pre .python .decorator, -pre .template_comment, -pre .pi, -pre .doctype, -pre .shebang, -pre .apache .sqbracket, -pre .tex .formula { - color: #95a5a6; -} -pre .deletion { - color: #c0392b; -} -pre .coffeescript .javascript, -pre .javascript .xml, -pre .tex .formula, -pre .xml .javascript, -pre .xml .vbscript, -pre .xml .css, -pre .xml .cdata { - opacity: 0.5; -} diff --git a/fly/Python入门/index.html b/fly/Python入门/index.html deleted file mode 100644 index 6c1e28c..0000000 --- a/fly/Python入门/index.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - Python入门 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/fly/Python新特性/index.html b/fly/Python新特性/index.html deleted file mode 100644 index e711286..0000000 --- a/fly/Python新特性/index.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - Python新特性 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/fly/自动化办公/index.html b/fly/自动化办公/index.html deleted file mode 100644 index 385a6a8..0000000 --- a/fly/自动化办公/index.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - 自动化办公 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/fly/自然语言处理/cs224n/index.html b/fly/自然语言处理/cs224n/index.html deleted file mode 100644 index 8b3fefe..0000000 --- a/fly/自然语言处理/cs224n/index.html +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - cs224n | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/fly/自然语言处理/index.html b/fly/自然语言处理/index.html deleted file mode 100644 index 3754aca..0000000 --- a/fly/自然语言处理/index.html +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - 自然语言处理 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/fly/飞蟒微课堂/LeetCode/index.html b/fly/飞蟒微课堂/LeetCode/index.html deleted file mode 100644 index a4015c8..0000000 --- a/fly/飞蟒微课堂/LeetCode/index.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - LeetCode | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/fly/飞蟒微课堂/index.html b/fly/飞蟒微课堂/index.html deleted file mode 100644 index c22cf9d..0000000 --- a/fly/飞蟒微课堂/index.html +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - 飞蟒微课堂 | FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/hugo.toml b/hugo.toml new file mode 100644 index 0000000..d1f5ddb --- /dev/null +++ b/hugo.toml @@ -0,0 +1,14 @@ +baseURL = 'https://flypython.com' +languageCode = 'en-us' +title = 'flypython' + + +theme = ["reveal-hugo"] + +[markup.goldmark.renderer] +unsafe = true + +[outputFormats.Reveal] +baseName = "index" +mediaType = "text/html" +isHTML = true \ No newline at end of file diff --git a/images/bg.png b/images/bg.png deleted file mode 100644 index b8045e4..0000000 Binary files a/images/bg.png and /dev/null differ diff --git a/images/bg_post.png b/images/bg_post.png deleted file mode 100644 index a38c8f6..0000000 Binary files a/images/bg_post.png and /dev/null differ diff --git a/images/bg_sm.png b/images/bg_sm.png deleted file mode 100644 index 87ea058..0000000 Binary files a/images/bg_sm.png and /dev/null differ diff --git a/images/class-01.png b/images/class-01.png deleted file mode 100644 index c488970..0000000 Binary files a/images/class-01.png and /dev/null differ diff --git a/images/class-02.png b/images/class-02.png deleted file mode 100644 index 645ef1b..0000000 Binary files a/images/class-02.png and /dev/null differ diff --git a/images/cs224n-01.png b/images/cs224n-01.png deleted file mode 100644 index 8e2dd89..0000000 Binary files a/images/cs224n-01.png and /dev/null differ diff --git a/images/cs224n-02.png b/images/cs224n-02.png deleted file mode 100644 index 7708e74..0000000 Binary files a/images/cs224n-02.png and /dev/null differ diff --git a/images/default_cover.jpg b/images/default_cover.jpg deleted file mode 100644 index 96b495a..0000000 Binary files a/images/default_cover.jpg and /dev/null differ diff --git a/images/leetcode-0000.png b/images/leetcode-0000.png deleted file mode 100644 index 9cf03d6..0000000 Binary files a/images/leetcode-0000.png and /dev/null differ diff --git a/images/leetcode-0101.png b/images/leetcode-0101.png deleted file mode 100644 index 8513ff3..0000000 Binary files a/images/leetcode-0101.png and /dev/null differ diff --git a/images/leetcode-0102.png b/images/leetcode-0102.png deleted file mode 100644 index 68c7755..0000000 Binary files a/images/leetcode-0102.png and /dev/null differ diff --git a/images/new-01.png b/images/new-01.png deleted file mode 100644 index 985fc3b..0000000 Binary files a/images/new-01.png and /dev/null differ diff --git a/images/new-02.png b/images/new-02.png deleted file mode 100644 index beb5a20..0000000 Binary files a/images/new-02.png and /dev/null differ diff --git a/images/nlp1.png b/images/nlp1.png deleted file mode 100644 index c2bcee2..0000000 Binary files a/images/nlp1.png and /dev/null differ diff --git a/images/oa1.jpg b/images/oa1.jpg deleted file mode 100644 index f41d837..0000000 Binary files a/images/oa1.jpg and /dev/null differ diff --git a/images/oa2.jpg b/images/oa2.jpg deleted file mode 100644 index 57e1362..0000000 Binary files a/images/oa2.jpg and /dev/null differ diff --git a/images/oa3.jpg b/images/oa3.jpg deleted file mode 100644 index bec3d58..0000000 Binary files a/images/oa3.jpg and /dev/null differ diff --git a/images/oa4.jpg b/images/oa4.jpg deleted file mode 100644 index 4e4efba..0000000 Binary files a/images/oa4.jpg and /dev/null differ diff --git a/images/tutorial1.png b/images/tutorial1.png deleted file mode 100644 index 6884bd7..0000000 Binary files a/images/tutorial1.png and /dev/null differ diff --git a/images/tutorial2.png b/images/tutorial2.png deleted file mode 100644 index 6bd6e9e..0000000 Binary files a/images/tutorial2.png and /dev/null differ diff --git a/images/tutorial3.png b/images/tutorial3.png deleted file mode 100644 index fcb0991..0000000 Binary files a/images/tutorial3.png and /dev/null differ diff --git a/images/wechat.png b/images/wechat.png deleted file mode 100644 index 5fbf2e6..0000000 Binary files a/images/wechat.png and /dev/null differ diff --git a/index.html b/index.html deleted file mode 100644 index da79ee2..0000000 --- a/index.html +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - FlyPython - 专业的Python学习社区 - - - - - - - - - - - -
-
- - - -
- - - -
-
-
- -
-
-
-
- - - -
- -
- -
- - - - -
- -
- - - - diff --git a/js/f25.js b/js/f25.js deleted file mode 100644 index 67732c5..0000000 --- a/js/f25.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * [删除ClassName] - * @param {*} element - * @param {*} className - */ -function removeClassName(element , className){ - if ( !hasClassName(element , className) ){ - return element; - } - element.className = ' ' + element.className.trim() + ' '; - element.className = element.className.replace(' ' + className + ' ' , ' ').trim(); - return element; -} -/** - * [添加className] - * @param {*} element - * @param {*} className - */ -function addClassName(element , className){ - if ( hasClassName(element , className) ){ - return element; - } - element.className = element.className.trim() + ' ' + className.trim(); - return element; -} - -/** - * [判断是否包含对应的className] - * @param {*} element - * @param {*} className - */ -function hasClassName(element , className){ - if ( (' ' + element.className.trim() + ' ').indexOf(' ' + className.trim() + ' ') >= 0 ){ - return true; - } - return false; -} - -/** - * [scrollToWindowTop 返回顶部] - * @return {[type]} [description] - */ -function scrollToWindowTop(){ - return window.scroll(0,0); -} - -var closeClassName = 'btn-close'; -var showClassName = 'show'; -var headerMenu = document.querySelector('#J_header_menu'); -var headerMenulist = document.querySelector('#J_header_menu_list'); - -if ( headerMenu && headerMenulist ){ - //h5菜单栏展示 - headerMenu.addEventListener('click' , (event)=>{ - event.preventDefault(); - event.stopPropagation(); - - if ( hasClassName(headerMenu , closeClassName) ){ - removeClassName(headerMenulist , showClassName); - removeClassName(headerMenu , closeClassName); - }else{ - addClassName(headerMenulist , showClassName); - addClassName(headerMenu , closeClassName); - } - }); -} \ No newline at end of file diff --git a/js/gitalk.min.js b/js/gitalk.min.js deleted file mode 100644 index ca8338f..0000000 --- a/js/gitalk.min.js +++ /dev/null @@ -1,20 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Gitalk=t():e.Gitalk=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist",t(t.s=75)}([function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(39)("wks"),o=n(24),i=n(2).Symbol,a="function"==typeof i;(e.exports=function(e){return r[e]||(r[e]=a&&i[e]||(a?i:o)("Symbol."+e))}).store=r},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";function r(e){return"[object Array]"===N.call(e)}function o(e){return"[object ArrayBuffer]"===N.call(e)}function i(e){return"undefined"!=typeof FormData&&e instanceof FormData}function a(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function u(e){return"string"==typeof e}function s(e){return"number"==typeof e}function c(e){return void 0===e}function l(e){return null!==e&&"object"==typeof e}function f(e){return"[object Date]"===N.call(e)}function p(e){return"[object File]"===N.call(e)}function d(e){return"[object Blob]"===N.call(e)}function h(e){return"[object Function]"===N.call(e)}function m(e){return l(e)&&h(e.pipe)}function v(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams}function g(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function y(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)}function b(e,t){if(null!==e&&void 0!==e)if("object"==typeof e||r(e)||(e=[e]),r(e))for(var n=0,o=e.length;n0;)n[r]=arguments[r+2];if(!g(e))return e;var o=e.attributes||e.props,i=G.h(e.nodeName||e.type,o,e.children||o&&o.children),a=[i,t];return n&&n.length?a.push(n):t&&t.children&&a.push(t.children),m(G.cloneElement.apply(void 0,a))}function g(e){return e&&(e instanceof q||e.$$typeof===z)}function y(e,t){return t._refProxies[e]||(t._refProxies[e]=function(n){t&&t.refs&&(t.refs[e]=n,null===n&&(delete t._refProxies[e],t=null))})}function b(e){var t=e.nodeName,n=e.attributes;if(n&&"string"==typeof t){var r={};for(var o in n)r[o.toLowerCase()]=o;if(r.ondoubleclick&&(n.ondblclick=n[r.ondoubleclick],delete n[r.ondoubleclick]),r.onchange&&("textarea"===t||"input"===t.toLowerCase()&&!/^fil|che|rad/i.test(n.type))){var i=r.oninput||"oninput";n[i]||(n[i]=T([n[i],n[r.onchange]]),delete n[r.onchange])}}}function _(e){var t=e.attributes;if(t){var n=t.className||t.class;n&&(t.className=n)}}function w(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function x(e,t){for(var n in e)if(!(n in t))return!0;for(var r in t)if(e[r]!==t[r])return!0;return!1}function E(e){return e&&e.base||e}function N(){}function C(e){function t(e,t){A(this),I.call(this,e,t,Y),M.call(this,e,t)}return e=w({constructor:t},e),e.mixins&&O(e,S(e.mixins)),e.statics&&w(t,e.statics),e.propTypes&&(t.propTypes=e.propTypes),e.defaultProps&&(t.defaultProps=e.defaultProps),e.getDefaultProps&&(t.defaultProps=e.getDefaultProps()),N.prototype=I.prototype,t.prototype=w(new N,e),t.displayName=e.displayName||"Component",t}function S(e){for(var t={},n=0;n1)for(var n=1;n=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(35);e.exports=function(e){return Object(r(e))}},function(e,t){e.exports=!0},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(7).f,o=n(11),i=n(1)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){n(96);for(var r=n(2),o=n(10),i=n(16),a=n(1)("toStringTag"),u=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],s=0;s<5;s++){var c=u[s],l=r[c],f=l&&l.prototype;f&&!f[a]&&o(f,a,c),i[c]=i.Array}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(14),o=n(2).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){var r=n(14);e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";(function(t){function n(e,t,n,o,i,a,u,s){if(r(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,o,i,a,u,s],f=0;c=new Error(t.replace(/%s/g,function(){return l[f++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var r=function(e){};"production"!==t.env.NODE_ENV&&(r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=n}).call(t,n(5))},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(8),o=n(93),i=n(40),a=n(38)("IE_PROTO"),u=function(){},s=function(){var e,t=n(29)("iframe"),r=i.length;for(t.style.display="none",n(57).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("