<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>于志腾的技术专栏</title>
    <description>Because it is not difficult to understand</description>
    <link>https://buqiucdn.github.io//</link>
    <atom:link href="https://buqiucdn.github.io//feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Sun, 04 Aug 2019 13:45:23 +0000</pubDate>
    <lastBuildDate>Sun, 04 Aug 2019 13:45:23 +0000</lastBuildDate>
    <generator>Jekyll v3.8.5</generator>
    
      <item>
        <title>playbook之yml内容讲解</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#yaml语法&quot; id=&quot;markdown-toc-yaml语法&quot;&gt;yaml语法&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#yaml变量引用&quot; id=&quot;markdown-toc-yaml变量引用&quot;&gt;yaml变量引用&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#支持的数据结构&quot; id=&quot;markdown-toc-支持的数据结构&quot;&gt;支持的数据结构&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#例子&quot; id=&quot;markdown-toc-例子&quot;&gt;例子&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;yaml语法&quot;&gt;yaml语法&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;大小写敏感&lt;/li&gt;
  &lt;li&gt;使用缩进表示层级关系（只能用空格不能使用tab）&lt;/li&gt;
  &lt;li&gt;yaml文件以”—“作为开始&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;yaml变量引用&quot;&gt;yaml变量引用&lt;/h2&gt;

yname: yzt
name: “”

&lt;h2 id=&quot;支持的数据结构&quot;&gt;支持的数据结构&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;字典&lt;/li&gt;
&lt;/ol&gt;

{name:yzt}

&lt;ol&gt;
  &lt;li&gt;列表&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
  &lt;li&gt;Aplle&lt;/li&gt;
  &lt;li&gt;Orange&lt;/li&gt;
  &lt;li&gt;Strawberry&lt;/li&gt;
  &lt;li&gt;liuliu&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
  &lt;li&gt;纯量&lt;/li&gt;
&lt;/ol&gt;

数字/布尔/字符串

&lt;h2 id=&quot;例子&quot;&gt;例子&lt;/h2&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
---
- hosts: 192.168.0.107
  remote_user: root
  vars:
    touch_file: imoocc.file
  tasks:
    - name: touch file
      shell: &quot;touch /tmp/&quot;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Wed, 07 Aug 2019 00:00:00 +0000</pubDate>
        <link>https://buqiucdn.github.io//2019/08/07/jekyll/</link>
        <guid isPermaLink="true">https://buqiucdn.github.io//2019/08/07/jekyll/</guid>
        
        <category>playbook</category>
        
        
        <category>Ansible</category>
        
      </item>
    
      <item>
        <title>playbook之yml配置</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#执行命令&quot; id=&quot;markdown-toc-执行命令&quot;&gt;执行命令&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;执行命令&quot;&gt;执行命令&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;列出可以执行主机的列表 –list-hosts&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ansible-playbook -i ./hosts --list-hosts ./f1.yml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ol&gt;
  &lt;li&gt;执行&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ansible-playbook -i ./hosts  ./f1.yml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;a href=&quot;Ansible is being run in a world writable directory (/private/etc/ansible), ignoring it as an ansible.cfg source. For more information see&quot;&gt;WARNING&lt;/a&gt;: Consider using the file module with state=touch rather than running ‘touch’.  If you need to use command because file is insufficient you can add ‘warn: false’ to this
</description>
        <pubDate>Mon, 05 Aug 2019 00:00:00 +0000</pubDate>
        <link>https://buqiucdn.github.io//2019/08/05/jekyll/</link>
        <guid isPermaLink="true">https://buqiucdn.github.io//2019/08/05/jekyll/</guid>
        
        <category>playbook</category>
        
        
        <category>Ansible</category>
        
      </item>
    
      <item>
        <title>playbook的组成</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#什么是playbook&quot; id=&quot;markdown-toc-什么是playbook&quot;&gt;什么是playbook&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#playbook-组成&quot; id=&quot;markdown-toc-playbook-组成&quot;&gt;playbook 组成&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#playbook的优势&quot; id=&quot;markdown-toc-playbook的优势&quot;&gt;playbook的优势&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;什么是playbook&quot;&gt;什么是playbook&lt;/h2&gt;

翻译过来就是剧本

&lt;h2 id=&quot;playbook-组成&quot;&gt;playbook 组成&lt;/h2&gt;

play: 定义的是主机角色
task：定义的具体的执行角色（部署代码/安装服务）
playbook: 由一个或者多个play组成，一个play可以包含多个task

&lt;h2 id=&quot;playbook的优势&quot;&gt;playbook的优势&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;功能比ad-hoc更全 （支持丰富的配置语法结构）&lt;/li&gt;
  &lt;li&gt;控制依赖关系&lt;/li&gt;
  &lt;li&gt;展示更加直观（配置文件）&lt;/li&gt;
  &lt;li&gt;持久使用&lt;/li&gt;
&lt;/ol&gt;

</description>
        <pubDate>Fri, 02 Aug 2019 00:00:00 +0000</pubDate>
        <link>https://buqiucdn.github.io//2019/08/02/jekyll/</link>
        <guid isPermaLink="true">https://buqiucdn.github.io//2019/08/02/jekyll/</guid>
        
        <category>playbook</category>
        
        
        <category>Ansible</category>
        
      </item>
    
      <item>
        <title>Ansible之代码部署</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#ansible-的配置目录&quot; id=&quot;markdown-toc-ansible-的配置目录&quot;&gt;Ansible 的配置目录&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#yum包管理配置源&quot; id=&quot;markdown-toc-yum包管理配置源&quot;&gt;yum包管理配置源&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#代码部署&quot; id=&quot;markdown-toc-代码部署&quot;&gt;代码部署&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;ansible-的配置目录&quot;&gt;Ansible 的配置目录&lt;/h2&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;macbookpro@bogon  /etc/ansible  tree
.
├── ansible.cfg
├── hosts
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;yum包管理配置源&quot;&gt;yum包管理配置源&lt;/h2&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/etc/yum.repos.d
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;代码部署&quot;&gt;代码部署&lt;/h2&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;如果机器上没有git 先要安装，注意下面的执行命令要用双引号

ansible one -m git -a &quot;repo=https://github.com/buqiucdn/buqiucdn.github.io dest=/opt/imoocc version=HEAD&quot; -f 5 -l 192.168.0.108

192.168.0.108 | CHANGED =&amp;gt; {
    &quot;after&quot;: &quot;9b0f58b04bca0d266b6c633b873471229cfb2568&quot;,
    &quot;ansible_facts&quot;: {
        &quot;discovered_interpreter_python&quot;: &quot;/usr/bin/python&quot;
    },
    &quot;before&quot;: &quot;HEAD&quot;,
    &quot;changed&quot;: true,
    &quot;remote_url_changed&quot;: false
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Thu, 11 Jul 2019 00:00:00 +0000</pubDate>
        <link>https://buqiucdn.github.io//2019/07/11/jekyll/</link>
        <guid isPermaLink="true">https://buqiucdn.github.io//2019/07/11/jekyll/</guid>
        
        <category>ad-hoc</category>
        
        
        <category>Ansible</category>
        
      </item>
    
      <item>
        <title>Ansible之ad-hoc</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#ansible-的配置目录&quot; id=&quot;markdown-toc-ansible-的配置目录&quot;&gt;Ansible 的配置目录&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#yum包管理配置源&quot; id=&quot;markdown-toc-yum包管理配置源&quot;&gt;yum包管理配置源&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;ansible-的配置目录&quot;&gt;Ansible 的配置目录&lt;/h2&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;macbookpro@bogon  /etc/ansible  tree
.
├── ansible.cfg
├── hosts
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;h2 id=&quot;yum包管理配置源&quot;&gt;yum包管理配置源&lt;/h2&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/etc/yum.repos.d
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Tue, 09 Jul 2019 00:00:00 +0000</pubDate>
        <link>https://buqiucdn.github.io//2019/07/09/jekyll/</link>
        <guid isPermaLink="true">https://buqiucdn.github.io//2019/07/09/jekyll/</guid>
        
        <category>ad-hoc</category>
        
        
        <category>Ansible</category>
        
      </item>
    
      <item>
        <title>Ansible之配置文件hosts</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#ansible-的配置目录&quot; id=&quot;markdown-toc-ansible-的配置目录&quot;&gt;Ansible 的配置目录&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#hosts-是什么&quot; id=&quot;markdown-toc-hosts-是什么&quot;&gt;hosts 是什么&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#hosts-几种不同的配置&quot; id=&quot;markdown-toc-hosts-几种不同的配置&quot;&gt;hosts 几种不同的配置&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
ansible.cfg

&lt;h2 id=&quot;ansible-的配置目录&quot;&gt;Ansible 的配置目录&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&quot;language-angular2&quot;&gt;macbookpro@bogon  /etc/ansible  tree
.
├── ansible.cfg
├── hosts
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;hosts-是什么&quot;&gt;hosts 是什么&lt;/h2&gt;
hosts是ansible自动化任务中所有的主机组
&lt;h2 id=&quot;hosts-几种不同的配置&quot;&gt;hosts 几种不同的配置&lt;/h2&gt;
1.密码登录

&lt;pre&gt;&lt;code class=&quot;language-angular2&quot;&gt;192.168.0.104:22 ansible_ssh_user=playcrab  ansible_ssh_pass='123456'
192.168.0.110:22 ansible_ssh_user=root  ansible_ssh_pass='123123'

&lt;/code&gt;&lt;/pre&gt;
2.公钥登录

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;192.168.0.104:22 ansible_ssh_user=playcrab  ansible_ssh_key_file=/Users/macbookpro/.ssh/id_rsa
192.168.0.110:22 ansible_ssh_user=root   ansible_ssh_key_file=/Users/macbookpro/.ssh/id_rsa
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

3.公钥配置在ansible.cfg

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;192.168.0.104:22 ansible_ssh_user=playcrab
192.168.0.110:22 ansible_ssh_user=root

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Fri, 05 Jul 2019 00:00:00 +0000</pubDate>
        <link>https://buqiucdn.github.io//2019/07/05/jekyll/</link>
        <guid isPermaLink="true">https://buqiucdn.github.io//2019/07/05/jekyll/</guid>
        
        <category>Ansible</category>
        
        
        <category>Ansible</category>
        
      </item>
    
      <item>
        <title>Ansible之配置文件ansible.cfg</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#ansible-的配置目录&quot; id=&quot;markdown-toc-ansible-的配置目录&quot;&gt;Ansible 的配置目录&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#ansiblecfg是什么&quot; id=&quot;markdown-toc-ansiblecfg是什么&quot;&gt;Ansible.cfg是什么&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
ansible.cfg

&lt;h2 id=&quot;ansible-的配置目录&quot;&gt;Ansible 的配置目录&lt;/h2&gt;
&lt;pre&gt;&lt;code class=&quot;language-angular2&quot;&gt;macbookpro@bogon  /etc/ansible  tree
.
├── ansible.cfg
├── hosts
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;ansiblecfg是什么&quot;&gt;Ansible.cfg是什么&lt;/h2&gt;
Ansible.cfg是ansible自动化任务所用的一个核心配置文件，大部分的配置文件都集中在defualts配置项目中。

</description>
        <pubDate>Wed, 03 Jul 2019 00:00:00 +0000</pubDate>
        <link>https://buqiucdn.github.io//2019/07/03/jekyll/</link>
        <guid isPermaLink="true">https://buqiucdn.github.io//2019/07/03/jekyll/</guid>
        
        <category>Ansible</category>
        
        
        <category>Ansible</category>
        
      </item>
    
      <item>
        <title>Ansible之安装</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#什么是ansible&quot; id=&quot;markdown-toc-什么是ansible&quot;&gt;什么是Ansible&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#ansible-的优势&quot; id=&quot;markdown-toc-ansible-的优势&quot;&gt;Ansible 的优势&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#ansible-的安装&quot; id=&quot;markdown-toc-ansible-的安装&quot;&gt;Ansible 的安装&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#ansible-的配置文件&quot; id=&quot;markdown-toc-ansible-的配置文件&quot;&gt;Ansible 的配置文件&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
Ansible基础与安装
&lt;h2 id=&quot;什么是ansible&quot;&gt;什么是Ansible&lt;/h2&gt;
Ansiblie 是python中的一个套模块，系统中的一套自动化工具，可以用来作为系统管理、自动化命令等任务
&lt;h2 id=&quot;ansible-的优势&quot;&gt;Ansible 的优势&lt;/h2&gt;
ansible 的play_book模式，采用yaml配置，对于自动化执行一目了然

&lt;h2 id=&quot;ansible-的安装&quot;&gt;Ansible 的安装&lt;/h2&gt;
&lt;ol&gt;
  &lt;li&gt;传统系统安装的方式，yum、apt-get&lt;/li&gt;
  &lt;li&gt;通过python的方式&lt;/li&gt;
&lt;/ol&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pip install ansible 

easy_install ansible

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
3.安装完成之后，在终端输入ansible如下图
&lt;img src=&quot;https://buqiucdn.github.io/upload/ansible.png&quot; alt=&quot;image&quot; /&gt;

&lt;h2 id=&quot;ansible-的配置文件&quot;&gt;Ansible 的配置文件&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;ansible.cfg 执行需求的全局性、默认的配置文件&lt;/li&gt;
  &lt;li&gt;hosts 默认机器资产清单文件&lt;/li&gt;
&lt;/ol&gt;

&lt;img src=&quot;https://buqiucdn.github.io/upload/ansible_host.png&quot; alt=&quot;image&quot; /&gt;

</description>
        <pubDate>Mon, 01 Jul 2019 00:00:00 +0000</pubDate>
        <link>https://buqiucdn.github.io//2019/07/01/jekyll/</link>
        <guid isPermaLink="true">https://buqiucdn.github.io//2019/07/01/jekyll/</guid>
        
        <category>Ansible</category>
        
        
        <category>Ansible</category>
        
      </item>
    
      <item>
        <title>python 帮助你表白 520</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#代码&quot; id=&quot;markdown-toc-代码&quot;&gt;代码&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#安装包&quot; id=&quot;markdown-toc-安装包&quot;&gt;安装包&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#效果&quot; id=&quot;markdown-toc-效果&quot;&gt;效果&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#成功&quot; id=&quot;markdown-toc-成功&quot;&gt;成功&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

身为一个码农，在最重要的日子需要展示一下自己的能力，与别人不一样的能力，那就撸一下代码，给ta一个惊喜！

&lt;h2 id=&quot;代码&quot;&gt;代码&lt;/h2&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/usr/bin/env python&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pylab&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;scipy&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scipy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linspace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1500&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;y1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scipy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sqrt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;y2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;scipy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sqrt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;abs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;pylab&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fill_between&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'red'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;pylab&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fill_between&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;color&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'red'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;pylab&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xlim&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;2.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;2.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;pylab&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'YZTXY 520 LOVE'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fontsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;fontweight&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'bold'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'blue'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;horizontalalignment&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;'center'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;pylab&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;show&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;安装包&quot;&gt;安装包&lt;/h2&gt;

&lt;blockquote&gt;
  sudo pip install matplotlib
&lt;/blockquote&gt;

&lt;blockquote&gt;
  sudo pip install scipy
&lt;/blockquote&gt;

&lt;h2 id=&quot;效果&quot;&gt;效果&lt;/h2&gt;

&lt;img src=&quot;https://buqiucdn.github.io/upload/520.png&quot; alt=&quot;image&quot; /&gt;

&lt;h2 id=&quot;成功&quot;&gt;成功&lt;/h2&gt;

快去表白吧！！！！

</description>
        <pubDate>Mon, 20 May 2019 00:00:00 +0000</pubDate>
        <link>https://buqiucdn.github.io//2019/05/20/jekyll/</link>
        <guid isPermaLink="true">https://buqiucdn.github.io//2019/05/20/jekyll/</guid>
        
        <category>python</category>
        
        
        <category>python</category>
        
      </item>
    
      <item>
        <title>Python 快速入门-变量</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#python中什么是变量&quot; id=&quot;markdown-toc-python中什么是变量&quot;&gt;Python中什么是变量&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

随着技术的不断的发展，python的应用场景越来越多，优势越来越明显，接下来一起我说一下自己的学习历程

&lt;h2 id=&quot;python中什么是变量&quot;&gt;Python中什么是变量&lt;/h2&gt;

&lt;hr /&gt;

在Python中，变量的概念基本上和初中代数的方程变量是一致的。

例如，对于方程式 y=x*x ，x就是变量。当x=2时，计算结果是4，当x=5时，计算结果是25。

只是在计算机程序中，变量不仅可以是数字，还可以是任意数据类型。

在Python程序中，变量是用一个变量名表示，变量名必须是大小写英文、数字和下划线（_）的组合，且不能用数字开头，比如

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;yzt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;123&lt;/span&gt;
&lt;span class=&quot;err&quot;&gt;变量&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;yzt&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;是一个整数。&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;yzts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'花开'&lt;/span&gt;

&lt;span class=&quot;err&quot;&gt;变量&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;yzts&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;是一个字符串。&lt;/span&gt;

&lt;span class=&quot;err&quot;&gt;在&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Python&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;中，等号&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;是赋值语句，可以把任意数据类型赋值给变量，同一个变量可以反复赋值，而且可以是不同类型的变量，例如：&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;yzt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;123&lt;/span&gt;    &lt;span class=&quot;c&quot;&gt;# yzt是整数&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;yzt&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;yzt&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;'YZTXY'&lt;/span&gt;   &lt;span class=&quot;c&quot;&gt;# yzt变为字符串&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;yzt&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Wed, 12 Sep 2018 00:00:00 +0000</pubDate>
        <link>https://buqiucdn.github.io//2018/09/12/jekyll/</link>
        <guid isPermaLink="true">https://buqiucdn.github.io//2018/09/12/jekyll/</guid>
        
        <category>python</category>
        
        
        <category>python</category>
        
      </item>
    
  </channel>
</rss>
